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:
-
Sign in to your cPanel account.
-
Launch File Manager and modify the .htaccess file.
-
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
-
Then, click "Save Changes" and close the file.
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.