Reputation: 353
Using .htaccess, is it possible to redirect http://www.mydomain.com
and http://mydomain.com
to HTTPS, while NOT redirecting http://staging.mydomain.com
or http://127.0.0.1
?
Also, what will happen to any POST data that goes through the redirected portion? Will it remain insecure, or will it also be encrypted?
Upvotes: 1
Views: 134
Reputation: 24448
This should get you going. Once redirected by apache, all data is processed through https.
RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Upvotes: 2