-1

I have a domain.co and just bought domain.com and want to use SSL on it.

Having in mind this H5BP apache config for HTTP to HTTPS redirect:

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

Once in place, will it automatically start redirecting all HTTP pages from domain.co to HTTPS pages on domain.com or I have to modify rule to something like this or similar?

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
</IfModule>
dzhi
  • 770
  • 3
  • 10
  • 23
  • I don't think that post follows current industry best practices.. – dzhi Feb 12 '15 at 12:42
  • That may be so. Nevertheless, it is a **canonical** answer, which means that it is all the community chooses to say on a particular subject. If you think it could be improved with a more up-to-date answer, please, by all means, write one. But it is likely that other questions on that subject will get closed; that's what canonical questions are for. – MadHatter Feb 12 '15 at 12:45

1 Answers1

1

The former will not work, as it will merely rewrite the URL to https and do nothing to the host. The latter in your example should correctly rewrite to https as well as the domain specified whilst requesting the originally requested resource. Only one way to be sure though - try it and find out!

BE77Y
  • 2,577
  • 3
  • 17
  • 23