<p>How do you redirect HTTPS to HTTP?. That is, the opposite of what (seemingly) everyone teaches.</p>

<p>I have a server on HTTPS for which I paid an SSL certification for and a mirror for which I haven't and keep around for just for emergencies so it doesn't merit getting a certification for.</p>

<p>On my client's desktops I have SOME shortcuts which point to <code>http://production_server</code> and <code>https://production_server</code> (both work). However, I know that if my production server goes down, then DNS forwarding kicks in and those clients which have "https" on their shortcut will be staring at <code>https://mirror_server</code> (which doesn't work) and a big fat Internet Explorer 7 red screen of uneasyness for my company. </p>

<p>Unfortunately, I can't just switch this around at the client level. These users are very computer illiterate: and are very likely to freak out from seeing HTTPS "insecurity" errors (especially the way Firefox 3 and Internet Explorer 7 handle it nowadays: FULL STOP, kind of thankfully, but not helping me here LOL).</p>

<p>It's <a href="http://www.cyberciti.biz/tips/howto-apache-force-https-secure-connections.html" rel="noreferrer">very easy</a> <a href="http://bytes.com/forum/thread54801.html" rel="noreferrer">to find</a> <a href="http://support.jodohost.com/showthread.php?t=6678" rel="noreferrer">Apache solutions</a> for <a href="http://www.google.com/search?q=https+redirection&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" rel="noreferrer">http->https redirection</a>, but for the life of me I can't do the opposite.</p>

<p>Ideas?</p>

[{'answer_id': 8380, 'author': 'ejunker', 'author_id': 796, 'author_profile': 'https://Stackoverflow.com/users/796', 'pm_score': 8, 'selected': True, 'text': '<p>This has not been tested but I think this should work using mod_rewrite</p>\n\n<pre><code>RewriteEngine On\nRewriteCond %{HTTPS} on\nRewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}\n</code></pre>\n'}, {'answer_id': 8429, 'author': 'Kieron', 'author_id': 588, 'author_profile': 'https://Stackoverflow.com/users/588', 'pm_score': 6, 'selected': False, 'text': "<p>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!</p>\n\n<p>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.</p>\n"}, {'answer_id': 12243355, 'author': 'RobinUS2', 'author_id': 1194580, 'author_profile': 'https://Stackoverflow.com/users/1194580', 'pm_score': -1, 'selected': False, 'text': '<p>As far as I\'m aware of a simple meta refresh also works without causing errors:</p>\n\n<pre><code>&lt;meta http-equiv="refresh" content="0;URL=\'http://www.yourdomain.com/path\'"&gt;\n</code></pre>\n'}, {'answer_id': 14496933, 'author': 'antoniom', 'author_id': 1149919, 'author_profile': 'https://Stackoverflow.com/users/1149919', 'pm_score': 4, 'selected': False, 'text': "<p>Based on ejunker's answer, this is the solution working for me, not on a single server but on a <strong>cloud</strong> enviroment</p>\n\n<pre><code>Options +FollowSymLinks\nRewriteEngine On\nRewriteCond %{ENV:HTTPS} on\nRewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]\n</code></pre>\n"}, {'answer_id': 14992526, 'author': 'rg88', 'author_id': 11252, 'author_profile': 'https://Stackoverflow.com/users/11252', 'pm_score': 3, 'selected': False, 'text': '<p>If none of the above solutions work for you (they did not for me) here is what worked on my server:</p>\n\n<pre><code>RewriteCond %{HTTPS} =on\nRewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301]\n</code></pre>\n'}, {'answer_id': 34027859, 'author': 'Rick', 'author_id': 1827424, 'author_profile': 'https://Stackoverflow.com/users/1827424', 'pm_score': 4, 'selected': False, 'text': '<p>For those that are using a <code>.conf</code> file.</p>\n\n<pre><code>&lt;VirtualHost *:443&gt;\n    ServerName domain.com\n    RewriteEngine On\n    RewriteCond %{HTTPS} on\n    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}\n\n    SSLEngine on\n    SSLCertificateFile /etc/apache2/ssl/domain.crt\n    SSLCertificateKeyFile /etc/apache2/ssl/domain.key\n    SSLCACertificateFile /etc/apache2/ssl/domain.crt\n\n&lt;/VirtualHost&gt;\n</code></pre>\n'}, {'answer_id': 39074632, 'author': 'sys0dm1n', 'author_id': 3768721, 'author_profile': 'https://Stackoverflow.com/users/3768721', 'pm_score': 2, 'selected': False, 'text': '<p>It is better to avoid using mod_rewrite when you can.</p>\n\n<p>In your case I would replace the Rewrite with this:</p>\n\n<pre><code>    &lt;If "%{HTTPS} == \'on\'" &gt;\n            Redirect permanent / http://production_server/\n    &lt;/If&gt;\n</code></pre>\n\n<p>The <code>&lt;If&gt;</code> directive is only available in Apache 2.4+ as per this <a href="https://blogs.apache.org/httpd/entry/new_in_httpd_2_4" rel="nofollow noreferrer">blog here</a>.</p>\n'}, {'answer_id': 42678635, 'author': 'mikulabc', 'author_id': 1679901, 'author_profile': 'https://Stackoverflow.com/users/1679901', 'pm_score': 3, 'selected': False, 'text': '<p>all the above did not work when i used cloudflare, this one worked for me:</p>\n\n<pre><code>RewriteCond %{HTTP:X-Forwarded-Proto} =https\nRewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\n</code></pre>\n\n<p>and this one definitely works without proxies in the way:</p>\n\n<pre><code>RewriteCond %{HTTPS} on\nRewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]\n</code></pre>\n'}, {'answer_id': 47252973, 'author': 'Yuseferi', 'author_id': 1381737, 'author_profile': 'https://Stackoverflow.com/users/1381737', 'pm_score': 1, 'selected': False, 'text': "<p>None of the answer works for me on Wordpress website but following works ( it's similar to other answers but have a little change)</p>\n\n<pre><code>RewriteEngine On\nRewriteCond %{HTTPS} on\nRewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]\n</code></pre>\n"}, {'answer_id': 54031418, 'author': 'jaxarroyo', 'author_id': 5258247, 'author_profile': 'https://Stackoverflow.com/users/5258247', 'pm_score': 2, 'selected': False, 'text': '<p>this works for me.</p>\n\n<pre><code>&lt;VirtualHost *:443&gt;\n    ServerName www.example.com\n    # ... SSL configuration goes here\n    Redirect "https://www.example.com/" "http://www.example.com/"\n&lt;/VirtualHost&gt;\n\n&lt;VirtualHost *:80&gt;\n    ServerName www.example.com\n    # ... \n&lt;/VirtualHost&gt;\n</code></pre>\n\n<p>be sure to listen to both ports 80 and 443.</p>\n'}, {'answer_id': 66254728, 'author': 'Khan Sharukh', 'author_id': 8621204, 'author_profile': 'https://Stackoverflow.com/users/8621204', 'pm_score': 0, 'selected': False, 'text': '<p>If you are looking for an answer where you can redirect specific url/s to http then please update your htaccess like below</p>\n<pre><code>RewriteEngine On\nRewriteCond %{HTTPS} off\nRewriteCond %{THE_REQUEST} !/(home/panel/videos|user/profile) [NC] # Multiple urls\nRewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\n\nRewriteCond %{HTTPS} on\nRewriteCond %{THE_REQUEST} /(home/panel/videos|user/profile) [NC] # Multiple urls\nRewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\n</code></pre>\n<p>It worked for me :)</p>\n'}]
['https://Stackoverflow.com/questions/8371', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/547/']