: Htaccess force ssl I need to force all traffic for all pages on example.com to https://www.example.com . After much googles, and hosting site help docs, the consensus (and what my hosting -
I need to force all traffic for all pages on example.com to www.example.com . After much googles, and hosting site help docs, the consensus (and what my hosting - BlueHost - docs say to do) is this:
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ www.example.com/ [R]
Which seems like it should work. But when I type in just example.com in a browser (FF or Chrome), the request is redirected to
www.example.com/https:/www.example.com/
The rule is at the top of the htaccess file, so don't understand why this is happening.
More posts by @Nimeshi995
1 Comments
Sorted by latest first Latest Oldest Best
RewriteRule ^(.*)$ www.example.com/ [R]
You probably need the L (last) flag. ie. [R,L]. Otherwise, with this directive being at the top of the .htaccess file, processing will continue through the file and it's likely to be rewritten again - so literally anything could happen. (I would be surprised if the Bluehost docs did not include this?)
Also, once you have confirmed this is working OK, you should change this to a permanent (301) redirect. ie. [R=301,L].
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.