PASSWORD PROTECT WEBSITE

www.

How do I password protect my website?

Please note: This support article is a guide for our Linux users only.

The following article explains how to password protect your website. This is done through the use of a .htaccess file and a .htpassword file. Either the entire website or a specific folder can be password protected. The .htaccess file is placed within the folder and links to a .htpasswd file that contains the login and password information. Typically the .htpasswd file is stored the same directory as the .htaccess file.

To password protect your website, please follow these steps:

  1. Log into your Linux web server via Secure Shell (SSH).
  2. Change into the directory you wish to password protect.

    Note: If you wish to protect your entire website us the following command:

    cd /vservers/username/htdocs
  3. Create a file called .htaccess using the following command:

    pico .htaccess
  4. Enter the following information:


    AuthType Basic

    AuthName "Please enter your Username and Password"

    AuthUserFile /vservers/username/htdocs/.htpasswd

    AuthGroupFile /dev/null

    Require valid-user
  5. Press ctrl+o to save the file.
  6. Press ctrl+x to exit the file.
  7. Create the .htpasswd file using the following command:

    /usr/bin/htpasswd -c /vservers/username/htdocs/.htpasswd username
  8. Enter the password you wish to use.
  9. Re-enter the password.
  10. Grant read access to each file using the following commands:

    chmod a+r .htaccess

    chmod a+r .htpasswd

Comments are closed.

By using this website you consent to the use of cookies in accordance with our Privacy Notice. You may opt-out at any time in the Cookies section of the Privacy Notice page.