How To Set A .htaccess Password

Securing web directories from .htaccess passwords is the best way to protect on Apache server
because it uses encoded passwords and it has different encoded codes for the same passwords which saves on another hidden file. Other features like adding and selecting IPs to access create more protected directories.

To enable .htaccess password follow the next simple steps:

wst5 300x235 WordPress Security Tips

Generate your username and password from here.
wst6 300x161 WordPress Security Tips

Then  copy the encoded username and password to a new file .htpasswd and save it in any folder before public_html in your cpanel.
wst7 300x200 WordPress Security Tips

Use .htaccess  to include .htpasswd with full web directory url by copying this code to .htaccess:
AuthType Basic
AuthName “Restricted Area”
AuthUserFile /home/abc/222/.htpasswd
require valid-user

After the whole process clear your browser cache and check it by accessing the directory!

Leave a Reply

Your email address will not be published. Required fields are marked *