Friday, June 27, 2008

HTTP to HTTPS Forwards Please

Why do some sites that require a secure connection not automatically forward you to the secure site? How hard is it to do? Not very! (with Apache at least)

 #How about a simple .htaccess file in the webroot?  
 #Force SSL for example.hwarf.com  
 RewriteEngine On  
 RewriteBase /  
 RewriteCond %{HTTPS} !=on  
 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Hopefully some sites will pay attention to this. I'm not mentioning any URLs.

1 comment:

  1. I agree. It can even be done easy in Windows World. First install SSL Cert. If you want one for free like Linux go to (http://support.microsoft.com/kb/840671#11)
    then setup IIS to require SSL
    (http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/56bdf977-14f8-4867-9c51-34c346d48b04.mspx?mfr=true)

    Linux is so much easier. 3 lines of code!
    Cheers!

    ReplyDelete