Reputation: 363
I would like to redirect traffic from mysite.com to mysite.com/folder, but also enforce SSL on all pages.
Currently we have this in httpd.conf we found from a sample somewhere, but I don't think that it is working correctly all of the time.
RewriteEngine on
RewriteRule ^/$ https://www.mysite.com/folder/ [R]
Upvotes: 2
Views: 824
Reputation: 18530
The ^/$
only matches if the request is for exactly /
, i.e. the root of the site. Anything else is not matched by it. Try .*
instead.
Note: if this rewrite rule is active for both the HTTP and the HTTPS version, that'll send you into an infinite redirect loop. In that case, you may need some kind of RewriteCond test, too.
Upvotes: 1