If you had an http website and/or non-www url structure and you installed an https protocole and you would like to force your server to redirect permanently all urls to https AND .www new version of your website you can simply apply (copy past) the following configuration into your .htaccess file found in the root folder of your website.

Code

RewriteEngine On

### WWW & HTTPS

# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Note: link juice (power of the link) will be 90-95% transferred to the https version according to moz SEO experts. So you don’t have to worry about your SEO.

Leave a Reply