1 Apr 2022

Redirecting your domain from https to http using .htaccess in cPanel

 

This article will show you how to use cPanel's file manager to force redirect all traffic coming over https:// to http:// via your .htaccess


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


==========

1. Log into cPanel.

2. Click the File Manager icon.

3. At the top right, click the Settings button.

4. Check the Show Hidden Files (dotfiles) box and click Save 

5. Now you have to locate the .htaccess file for the site you want to apply the redirect to.  In most cases, it will be located in the public_html folder so we will double click that.

6. From here, find your .htaccess file, right click it and click Edit

7. Now at the top of the file, copy and paste the following code:

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

Like so:

8. Lastly click Save Changes at the top right.

Going forward anytime someone visits your site using https:// they will be redirected to http://


Disable Apache Web Directory Listing Using .htaccess File

Disable Apache directory listing using .htaccess

If you don't have administrator access to the system or want to manage directory listing on a per-directory basis easily, you can use the above Options -Indexes directive in .htaccess files.

  1. Open or create .htaccess file on the directory that you want to disable listing using your preferred text editor.
    $ sudo vi /var/www/mysite/.htaccess
  2. Add -Indexes to Options directive in the .htaccess file.
    Options -Indexes



https://www.simplified.guide/apache/disable-directory-listing