Pages

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.