the-miz
asked on
Forcing Apache to use HTTPS
I have tried several attempts at forcing my RHEL 5 web server running PHP 5.3 and Apache 2.2.3 to always use HTTPS instead of HTTP. I want wherever anyone goes or whatever anyone types into the address bar of the web browser to automatically use https://
I have tried the following without success:
RewriteCond %{HTTPS} off
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Need help!
I have tried the following without success:
RewriteCond %{HTTPS} off
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Need help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Beautiful. Worked! Thanks a million
RewriteRule ^/(.*) https://www.yourdomain.com/$1 [R,L]
http://www.cyberciti.biz/tips/howto-apache-force-https-secure-connections.html