: Switch to https I'm looking to use an .htaccess file to use mod_rewrite to switch the protocol from http:// to https:// when someone hits my website. For instance, once someone goes to: http://www.mywebsite.com/
I'm looking to use an .htaccess file to use mod_rewrite to switch the protocol from to when someone hits my website.
For instance, once someone goes to: www.mywebsite.com/
I'd like the browser to switch to: www.mywebsite.com/
The same goes for the mywebsite.com/ -> mywebsite.com
This is the following code I've been using and I've experienced some odd things so if anyone could provide me with information if this is the right way to do it, or if you have a better way, please provide it. Thanks in advance.
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ www.ebaillv.com/ [R=301,L]
More posts by @Merenda212
1 Comments
Sorted by latest first Latest Oldest Best
You could try checking for HTTPS instead of whether the port is 443. Also, the rule below matches everything and redirects it to exactly the same as it was but with the https. You could probably throw the [R=301, L] at the end of it if you wanted.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.