The .htaccess
file is a powerful configuration file used on Apache-based servers (like Aviumshost). You can use it to control access, apply redirects, and enhance security.
Examples:
1. Block an IP Address:
Order Deny,Allow Deny from 123.456.789.0
2. Password Protect a Directory:
AuthType Basic AuthName "Restricted Area" AuthUserFile /home/youruser/.htpasswd Require valid-user
3. Disable Directory Listing:
Options -Indexes
To edit .htaccess:
- Open File Manager in cPanel.
- Make sure hidden files are visible.
- Edit the
.htaccess
file in your domain’s root folder.
Warning: Always back up your .htaccess file before editing. A typo can cause site errors.