Force redirect to http.NOT https!

One of my clients ssl cert has buggered up, we’re trying to fix it, but it’s taking time.

At the moment I redirect all traffic to https in the HT access file using the following…

RewriteOptions inherit
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$$1 [R,L]

I’ve tried changing the https bits to http and vica-versa, but that just resulted in an error page saying too many redirects.

Anyone know ho to do this?

I found this using a mysterious tool called Google.

I found that, or something similar, earlier, but it no work.


RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

But still get the error, even when cache cleared. Unless, it’s a super agressive cache!

I get an error there, though it works if I go straight to www without the https. I hope this is not GoDaddy involved with the SSL. If it’s your own hosting you can presumably sort that out.

My hosting, but the issue is (we think) nameserver level, and we don’t have the domain, so at the moment trying to talk to the registrar via the client and getting nowhere.

The cert is failing due to nameserver issues.

Going direct to the www will work, as the redirect to https has been removed. The problem is, Google is sending to the https. Hence, I need the http redirect.

That doesn’t make a lot of sense on the nameservers. They just point to the server and not a specific domain, let alone https version. Have you checked the SSL status in cPanel? Assuming you have changed nothing in the zone editor it might just be something with the issuing side.

Make little sense to me neither, but I don’t get involved in server and domain stuff. All I know is what my server guy is telling me. I do know the way this one was setup was not the norm, as the client wanted to retain their own email service.

Make sure you comment this out and not just change https: to http:. Port 80 is for non-ssl, and that would create a loop if you’re redirecting to http.

Edit: # at the start of a line to make it a comment.

Thanks, but I’m an idiot at this stuff, can you elaborate on what you just said?

If you left these two lines in the htaccess file as shown below, they will create a loop.

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$$1 [R,L]

The rule says if any request comes in on port 80, which all non-ssl traffic would come in on, then redirect the traffic to the non-ssl url. Rinse and repeat over and over again.

Either remove them completely or comment them out as such:

# RewriteCond %{SERVER_PORT} 80 
# RewriteRule ^(.*)$$1 [R,L]

If the browser opens a https connection, and a wrong certificate will be delivered to the browser, it could be that even the htaccess is not “executed”, so that no redirect happens.

1 Like

Anybody else receiving update notifications after 2 days? I’ve just had two come through for this thread.

Yes. I just got one that was 2 days old for this thread.