0

I am trying to redirect my website from HTTPS to HTTP but every time I am getting the issue. I have cleared the cache. I have checked the previous questions but still getting the same issue.

I am using WordPress. SSL has expired today and I have to redirect now. I have some code in the htaccess.

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


# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
#RewriteCond %{HTTPS} !on
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

#RewriteCond %{SERVER_PORT} 80
#RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
#RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

</IfModule>

# END WordPress

is there any issue with the code?

Firefox

enter image description here

Chrome

enter image description here

James Z
  • 12,209
  • 10
  • 24
  • 44
Naren Verma
  • 2,205
  • 5
  • 38
  • 95
  • 1
    "SSL is expired today" - If you don't have a valid SSL cert then you can't issue a redirect without (at best) getting a SSL cert warning in the browser. (At worst you don't connect at all.) This is stated in [the second highest voted answer on the first question you linked to](https://stackoverflow.com/a/8429/369434). And in [the accepted answer of the second question you linked to](https://stackoverflow.com/a/13000059/369434). If you could execute server-side code with having an invalid SSL cert and no warning/error then it defeats the point of SSL to begin with. This is to protect the user. – MrWhite Feb 28 '22 at 17:22
  • @MrWhite, Yes, I read that too. Do I need to get SSL cert? – Naren Verma Feb 28 '22 at 17:26
  • 1
    Yes, you need to "get [an] SSL cert". There is no other way around this. (It also doesn't make sense to redirect HTTPS to HTTP. It should be HTTPS everywhere. https://stackoverflow.com/questions/45970795/moving-from-https-to-http.) – MrWhite Feb 28 '22 at 17:35
  • @MrWhite, SSL cert, and SSL both are two different things? because if I get SSL then it' not require to redirect – Naren Verma Feb 28 '22 at 17:42
  • 1
    Well, yes, exactly. (Although that doesn't stop some users from trying to do so - as indicated by the number of questions asking this.) – MrWhite Feb 28 '22 at 17:48

0 Answers0