1

The problem: I cannot get my site to redirect from https to http.

OK, there are a number of solutions offered on this but none seem to be working for me. To establish a few things, I already have .htaccess working fine on this site so needing to set AllowOverride is taken out of the equation.

The most basic I have seen is to add something like:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

...to my .htaccess file. However this does nothing at all... as if the condition is not being met. After setting that and visiting https://mysite.com I am not redirected to http://mysite.com as I would expect rather I simply get through to https://mysite.com.

What is the cause of this? My expectation would be that with the above in my .htaccess file and with .htaccess files working fine on my site, that when I visit any https url I will be redirected to it's http equivalent.


More info

On Staging Server On my staging server adding the above to htaccess sends me to a url with a parameter appended to it like http://mystaging-site.com/?ysid=2pnd073423ra966tihf22rfr9a2

On Prod Server A quickie test on production results in an apache error page that says the page has been moved and there ws a 500 server error.

The specific of the error message are:

Found

The document has moved here. <--- this link simply points to the same page I am already on

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Here is the existing htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

And the following fails:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTPS} =on  //(with or without the equals symbol this fails)
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

RewriteCond %{HTTP_HOST} !^www.mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Lothar_Grimpsenbacher
  • 1,647
  • 3
  • 18
  • 27

1 Answers1

2

Close, but not quite, try:

RewriteEngine On
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301]
R. S.
  • 1,624
  • 12
  • 19
  • 1
    That doesn't change anything (and I think the equals symbols isn't strictly required... regardless, it has the same behavior as what I tried in that it does not work in the same way) – Lothar_Grimpsenbacher Feb 21 '13 at 00:05
  • Try that edit. FWIW, my rule is very similar (I use `SERVER_NAME` rather then `HTTP_HOST`) and this works just fine. – R. S. Feb 21 '13 at 00:15
  • Sweet. Glad to have helped :) – R. S. Feb 21 '13 at 00:18