How do you redirect HTTPS to HTTP? How do you redirect HTTPS to HTTP? apache apache

How do you redirect HTTPS to HTTP?


This has not been tested but I think this should work using mod_rewrite

RewriteEngine OnRewriteCond %{HTTPS} onRewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}


Keep in mind that the Rewrite engine only kicks in once the HTTP request has been received - which means you would still need a certificate, in order for the client to set up the connection to send the request over!

However if the backup machine will appear to have the same hostname (as far as the client is concerned), then there should be no reason you can't use the same certificate as the main production machine.


Based on ejunker's answer, this is the solution working for me, not on a single server but on a cloud enviroment

Options +FollowSymLinksRewriteEngine OnRewriteCond %{ENV:HTTPS} onRewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]