Search code examples
phpwordpress.htaccesshttp-redirect

How to stop random redirects to HTTPS?


I'm facing a very annoying issue for a long time, perhaps someone could shed a light on this matter...

All my Wordpress websites at shared enrivonment at Hostinger all have the same bug: Random redirects to HTTPS

Sometimes it tries to load all resources through HTTPS - seems randomly.

Most of the time though, the redirect occurs on wp-admin, while saving posts, navigating, etc.

I already added this to .htaccess, for example:

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

These are default wordpress installations with no settings changed, it's really a bug, Hostinger already acknolwedged that. They said they would fix it, but it's been more than 6 months.

The certificate is issued to *.main-hosting.eu and the error is NET::ERR_CERT_AUTHORITY_INVALID

How can I redirect ALL HTTPS requests to HTTP? How can I solve this bug?

-- Edit --

I confirmed it's a server-side bug, creating a simple debug.php with the following code: http://pastebin.com/n8PekA6d - the result is this: http://pastebin.com/t70nkTyj


Solution

  • I watched your video. Although I would normally recommend enabling https, in this case you might be off better with:

    $_SERVER['REQUEST_SCHEME'] = 'http';
    $_SERVER['SERVER_PORT'] = 80; //thanks to Lucas Bustamante
    

    in your wp-config.php. Hope that helps :)