Monday, October 21, 2013

Redirect all http request to https

I got a request to redirect all http request in apache to https

Backup current httpd.conf file

Enable mod_rewitre

Add the following line in httpd.conf just below

<Directory "/var/www/html"> (In my case only one domain is hosted in that server)
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

Restart httpd

No comments:

Post a Comment