0

I would like to force all visitors to access my website on https://

Does this look standard and SEO friendly?

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

1 Answers1

0

Anyone of the following would work

RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [L,R]

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [L,R]

Be careful with the R=301 redirect. Once a browser loads one of those, it stores it FOREVER ! If you ever want to go change the redirect it becomes very hard to do. Use a R or R=302 instead to start with.

Mike K
  • 11
  • 1