Tuesday, 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.

No comments:

Post a Comment

Comments, Suggestions or "Thank you's" Invited!