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.

  1. Avatar di Giannis Stoilis Giannis Stoilis

    Monday, May 17, 2010 - 13:49:50

    I use:
    Redirect / https://www.site.com/

    I think it’s simpler AND you don’t need to enable the Rewrite Engine.