https to http redirect htaccess – How to redirect from HTTPS to HTTP?

https to http redirect htaccess – To redirect your website from HTTPS to HTTP, add the following rule in your website’s .htaccess file:

https to http redirect htaccess

Redirect HTTPS to HTTP

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

To redirect from HTTPS to HTTP

home page only using the following rule.

RewriteCond %{HTTPS} on
RewriteRule ^/?$ http://%{SERVER_NAME}/ [R=301,L]

Https to http redirect using htaccess

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

1. Open .htaccess file

$ sudo vim /var/www/html/.htaccess

2. Add Rewrite Rule to .htaccess

RewriteEngine on

# force ssl
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

don’t Miss : Https To Http Redirect Using .Htaccess File

Also Read This 👉   z or r twice - Best 10 hidden Google tricks we bet you didn't know!

also redirect HTTP to HTTPS in your virtual host’s config file.

<VirtualHost *:80>
   Redirect permanent /

<VirtualHost _default_:443>
   DocumentRoot /var/www/html/domain-name
   SSLEngine On
# etc...

Free Live Chat for Any Issue

and last 3. Restart Apache Server

$ sudo service apache2 restart

I hope you get an idea about https to http redirect htaccess.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.