How to Restrict Access to the .htaccess File with cPanel?

Securing your hosting, .htaccess files are crucial hidden components. We strongly advise safeguarding them with .htaccess rules, and one effective method is by restricting access through cPanel File Manager.

To Restrict Access to .htaccess File:

  1. Sign in to your cPanel account.

  2. Launch File Manager and modify the .htaccess file.

  3. Add the following code to the file's conclusion:

# Disallow access to hidden files, which begin with a dot (.)

Order allow,deny

Deny from all

  1. Then, click "Save Changes" and close the file.

https://www.milesweb.in/hosting-faqs/wp-content/uploads/2021/11/cp_htaccess_deny_access.jpg

If you possess a VPS or dedicated server, securing the .htaccess and hidden files across all sites is paramount. Simply edit the /home/.htaccess file and input the code there.


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 432