How to redirect your site from HTTPS to HTTP?

htpps to http

Redirect from HTTPS to HTTP with .htaccess

There may be some exceptions when you want to redirect a particular website to open via HTTP instead of HTTPS. You can add the following codes to your website’s .htaccess file to switch from HTTPS to HTTP. If the .htaccess file doesn’t exist, you can create it with the same name. (The .htaccess file is hidden under the public_html folder on Linux hosts. If you can’t see it, use the show hidden files option.)

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

If you are using Linux hosting with this code above, you can switch from HTTPS to HTTP. It will redirect https://urdomain.com to http://urdomain.com.

Redirect from HTTP to HTTPS with .htaccess

There is also the process of redirecting from HTTP to HTTPS, which is the opposite of the above process. If you have received an SSL certificate for your existing site, you must forward your old HTTP pages to HTTPS with a 301 redirect. You should also know that the SSL certificate is a positive factor for SEO. You can use any of the codes below.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^siteniz\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourwebsite.com/$1 [R,L]

or

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourwebsite.com/$1 [R,L]

With these codes, you can switch from HTTP to HTTPS.

Location of .htaccess File in Cpanel

The .htaccess file you will normally process is under the public_html folder.

  1. After logging into your panel, click on the file manager
  2. Go into the public_html folder.

If you can’t see the file here, maybe you have the option to show hidden files turned off.

Tags:

More Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Latest Posts
Menu