certforumz.com

Hosting Related => Hosting Related => Topic started by: certforumz on July 10, 2017, 03:46:51 AM

Title: How to migrate htaccess to SSL website
Post by: certforumz on July 10, 2017, 03:46:51 AM
Redirect everything to HTTPS

There is hardly any reason not to run your website over SSL (HTTPS). Also it is very important that you answer to both HTTP and HTTPS. This snippet redirects all non-HTTPS traffic to HTTPS:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

It is important to choose one true (canonical) URL for SEO reasons.

Source:
https://www.leaseweb.com/labs/2015/10/rewritecond-and-rewriterule-tricks-for-htaccess/