Htpasswd Generator

Htpasswd Form

Enter the username to be used for the htpasswd file, and the password to be encrypted:

Your result can be seen below.

Result of htpasswd generation

No results.

Copy and paste this into your .htpasswd file

About online htpasswd generator

What is the htpasswd?

The Apache HTTP Server can use a .htpasswd file referenced from a .htaccess file to create restricted protected areas. The .htpasswd file contains rows corresponding to a pair of username and password separated with a colon character. The password is encrypted using the UNIX system's crypt method and may use MD5 or SHA1.

This .htpasswd generator creates passwords that are hashed using the MD5 algorithm. Those passwords can be used on any platform including Windows, MacOsX and Linux.

How it Works?

Just enter username and password and an entry for a htpasswd file is generated. This htpasswd generator creates passwords that are hashed using the MD5 algorithm, which means that you can use it for sites hosted on any platform, including Windows and Linux.

To generate a secure and strong password, use password generator.

Protecting a folder in Apache

To protect a specific folder, a .htaccess file is placed in the directory you want the contents of the file to affect. The rules and configuration directives in the .htaccess file will be enforced on whatever directory it is in and all sub-directories as well. A typical .htaccess file looks like the following:

AuthUserFile /path/to/.htpasswd
AuthType Basic
AuthName "My restricted Area"
Require valid-user

Protecting a folder in Nginx

To protect a specific folder, you need to update your website nginx config like:

location /api {
    auth_basic           "Administrator's Area";
    auth_basic_user_file /path/to/.htpasswd;

Alternatively, you you can limit access to the whole website with basic authentication but still make some website areas public. In this case, specify the off parameter of the auth_basic directive that cancels inheritance from upper configuration levels:

server {
    auth_basic           "Administrator's Area";
    auth_basic_user_file /path/to/.htpasswd;

    location /public/ {
        auth_basic off;