Promo1

Htaccess Password Generator

Free service that allows users to easily generate passwords compatible with .htpasswd files to protect a folder of your website. We have also included a tutorial on how to protect a folder with .htaccess.

Insert text:



How to protect a folder in your website with .htaccess ?

Create a file named .htaccess and place it in the folder you want to protect.
In this example I will protect the entire website and I will place the file in /var/www/yourwebsite.com/public_html/.htaccess.
AuthUserFile "/var/www/yourwebsite.com/.htpasswd"
AuthGroupFile /dev/null
AuthName "Private Area"
AuthType Basic
require valid-user
Now type:
chmod 644 /var/www/yourwebsite.com/public_html/.htaccess
Create a file named .htpasswd in /var/www/yourwebsite.com/.htpasswd
and write your username and the generated password in this format:
username:generated_password
Now type:
chmod 644 /var/www/yourwebsite.com/.htpasswd
Edit the .conf file of your domain in apache directory (/etc/apache/sites-available/yourwebsite.com) as follow:
<Directory /var/www/yourwebsite.com/public_html/>
...
AllowOverride AuthConfig
...
</Directory>
And finally reload apache configurations:
/etc/init.d/apache reload