Help Docs Control Panel Guides Cloud Sites Guide Website Management in Cloud Sites Use .htaccess to Password Protect Your Site in Cloud Sites

Use .htaccess to Password Protect Your Site in Cloud Sites

While developing your Cloud Sites website, you can use .htaccess to password protect your site or specific pages for added security.

During development, testing, and creation of your Cloud Sites website you may want to password protect your site until it’s ready for public consumption. You may also have specific pages or web directories you’d like to lock down to specific users. .htaccess is a powerful tool to help you accomplish this within the Cloud Sites framework. This tutorial will walk you through creating a password to protect your sites, directories, and other components of your site.

Note:

.htaccess is native to Apache, it will not work for other webservers (Nginx, for example).
  1. First, you will need access to the Document Root for the site. This is where you will house the .htaccess file and also the .htpasswd file in order to password protect your site. The file path will look something like this:
    /mnt/path/to/youraccount/www.domain.com/web/content
  2. The .htpasswd file should be placed one directory up from the site root and kept separate from the .htaccess file.

    Tip:

    Placing the .htpasswd file above the content/ folder is safer since it is not directly accessible via a web browser.
  3. You will need to generate the syntax for the .htaccess and the .htpasswd files. You can use any site you’d like, but for the purpose of this article, I am using web2generators.com.
  4. Once you follow the steps to create the files, you will need to place the syntax onto your server. If you already have an .htaccess file on your site, you can append the file and add the additional syntax.
  5. Upload the .htpasswd file into the location you determined in step 2.
  6. Check the permissions of the files to make sure the users you want to have permissions will be able to access them.
Was this article helpful?