My website, for example, https://example.com was running on https. Now, ssl certificate validity is expired on host server. So there is requirement to redirect traffic to http://example.com. All users were initially using https://example.com, so their browser automatically picks https. http is working fine. How to redirect traffic to http if someone attempts to access using https. https gives error:

ERR_SSL_PROTOCOL_ERROR This site can’t provide a secure connection

I already viewed this question, but it has been marked off-topic, so there are not more suggestions/answers. Sometimes, solution provided by one works for one and does not work for another.

1 Answers

0
Chuncvl On

Edit the .htaccess file with the following settings:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Rewriting on more conditions can be found at (such as user-agent): https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html

Explanations of the flags (R=...,L) can be found at https://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_l

Reference: Https to http redirect using htaccess