What's going on in Mesiols work day

Thursday, February 26, 2009

rewrite all http to https in Apache


i had to do some web server configuration. Requirement was, that all http traffic should be redirected to https on the server.

I used mod_rewrite to do the job with the following configuration statement

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

Don't forget to configure SSL on the server :)