May
15
2010
Automatically redirect http to https

I am working on an un-trusted network at the moment, so i want to login to my web site over httpS and not http! Thats not a problem for my, but i want all my users/clients to use httpS also. I cant observe everything they write but i can redirect their traffic for my web site to httpS.

If your web server supports rewrite module then it can be done by passing the below lines to your .htaccess file

Here is the way:

RewriteEngine on

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

Simple as that.