View Single Post
Old 20th May 2009, 09:35
Ben Ben is offline
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts

Well I am using mod_rewrite to redirect all http for a host to https, so this should work vice versa:

Code for http -> https
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
Should do for https to http
RewriteEngine On
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [L,R]
But keep in mind, that anyway all users will get the cert warning if it not fits a known CA, is invalid, does not fit the hostname etc. anyway. Only _after_ establishing the ssl conn the rewrite request will be processed.

Also this config needs to be done for every user (afaik you can not set those rewrite rules for all vhosts from a global base?!)
Reply With Quote