Best Practice: 301 Redirect HTTP to HTTPS (Standard Domain)
To start with your favorite solution: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L] </IfModule> In the part handling non-https URLs you are redirecting to %{HTTP_HOST}. Then, in case your host name started with “www”, a second redirect has to take place to send … Read more