How to protect .htaccess file?

How to protect .htaccess file?

For security reasons, we recommend that you avoid unauthorized access to your .htaccess file.

To do this, you need to understand how to find this file.

You can edit the .htaccess file using an FTP client or through cPanel.

Adding the security code to the .htaccess file

STEP 1:

Log into your cPanel account and open the File Manager in the Files section.

You must have made the correct settings to show the hidden files.

Because the .htaccess file is a hidden file with a period prefix; it means that you can see it if you have not activated it to be visible.

STEP 2:

You should search the public_html directory for ".htaccess."


Right click to edit the file and click edit.

STEP 3

Add this code:

# .htaccess protection

order allow,deny

deny from all

satisfy all

Click the "Save Changes" button displayed in the upper right corner.


This code will restrict unauthorized access to your .htaccess file.

    • Related Articles

    • How to edit a file in FIle Manager

      1. Log into your cPanel account. 2. In the "Files" section, click on "File Manger" Icon.   3. Navigate to the directory where your file is located and right click on the file and then click on "Edit"" in the Context Menu.  4. If the small "Code ...
    • How to create a file in File Manager

      1. Log into your cPanel account. 2. In the "Files" section, click on the "File Manger" Icon.  3. Navigate to directory path you want and click on the "File" Icon. 4. In the "New Filename Field" enter your filename like "MyFile.txt" (without the ...
    • How to use File Manager and upload a file

      If you don't want to use a 3rd party FTP Software, you can use the cPanel's inbuilt File Manager.       1. Log into your cPanel account.       2. In the "Files" section, click on the "File Manger" Icon.                3. Once in File Manager ...
    • How to protect a folder with username and password

      You can password lock a directory using cPanel's "Directory Privacy" option. 1. Log in to your cPanel account, see how to access cPanel at: https://help.scriptcase.net/portal/en/kb/articles/first-steps-with-the-hosting-access 2. In the "Files" ...
    • Import a CSV file to MYSQL via PHPMYADMIN

      I was given access to an existing instance of MySQL via phpMyAdmin. My task was to import a CSV file using the import feature on phpMyAdmin. First, I went to the the main phpMyAdmin page. Next, I clicked on the database instance that I am interested. ...