January 15, 2013

Redirect http to https on Apache server (httpd)

After googling http to https redirect, I found several answers that simply did not work (for me).  Finally I came across one that did:

In the directory of your web-content, create the file .htaccess and fill it with these directives:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}

That's it.

This worked on CentOS 6.3 and Apache 2.2.15

p.s. Don't forget your firewall settings.
Please consider crypto tipping:
  

No comments:

Post a Comment

Comments, Suggestions or "Thank you's" Invited! If you have used this info in any way, please comment below and link/link-back to your project (if applicable). Please Share.
I accept Bitcoin tips of ANY amount to: 1GS3XWJCTWU7fnM4vfzerrVAxmnMFnhysL
I accept Litecoin tips of ANY amount to: LTBvVxRdv2Lz9T41UzqNrAVVNw4wz3kKYk