How to force use HTTPS and WWW in .htaccess file

Video Tutorial



Explaination

If you have purchase SSL certificate for your website or want to use our SSL certificate for free.

You have to login into your website via ftp connection using software like filezilla, winscp.

Create a file name .htaccess (starting with dot and end on ss) and just paste the following code in the file and click save.

​<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond !{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

  • How to force use HTTPS, htaccess, https, ssl
  • 7 Users Found This Useful
Was this answer helpful?

Related Articles

How to create email account?

Video TutorialExplainationLog in to cpanel using your username and your cpanel password at...

How to change webmail password from cPanel?

Log in to cPanel using your username and your cPanel password at http://yourdomain.com/cpanel,...

How to add addon domain in cPanel?

Log in to cPanel using your username and your cPanel password at http://yourdomain.com/cpanel,...

How to change cPanel password?

Log in to cPanel using your username and your cPanel password at http://yourdomain.com/cpanel,...

How to change PHP version from cPanel ?

Video TutorialExplainationLog in to cPanel using your username and your cPanel password at...