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:

  1. Open File Manager in cPanel.
  2. Make sure hidden files are visible.
  3. 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.