Mob: +91 706-199-9900

If we install SSL Certificate for our website, then we need to move from http to https. This is done by .htaccess file and there is a simple code which is used.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301] 

The only real difference here is that first we redirect from non-WWW to WWW then we check for HTTPS and redirect it.

 

Leave a Reply

Your email address will not be published. Required fields are marked *