...Password Protect Directories

Any issues with adjusting your .htaccess file fall under our Best Effort support policy. Best Effort does not include content management, coding or designing for your websites. We may also direct you to a better resource for your issue, such as Plugin Developer, Designer, Software Author etc. Best Effort is not covered under the same SLA's as our supported services and does not guarantee any future support for any issue. Please understand that Best Effort issues may take longer to resolve.

During development, testing and creation of your iThemes Hosting website, you may want to password protect your site until it's ready for public viewing. You may also have specific pages or web directories you'd like to lock down to specific users. The .htaccess file is a powerful tool to help you accomplish this within the iThemes Hosting framework. This tutorial will walk you through creating a password to protect your sites, directories, and other components of your site. This tutorial also assumes that you are familiar with accessing your site via SFTP.

  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: 
    /eed292b5.ithemeshosting.com/web/content/
    It will be found in the SFTP information section with the title of "Path" on your iThemes Hosting page in Sync. Make sure you are using the FTP Information path and not the UNIX Path.

    FTPInfo.png
     
  2. The .htpasswd file should be placed one directory up from the site root and kept separate from the .htaccess file.

    Note:  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 http://tools.dynamicdrive.com
  4. Once you follow the steps to create the files, you will need to place the syntax on your server. If you already have a .htaccess file on your site, you can append the file and add the additional syntax.
  5. Upload the .htpasswd file to 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.
Have more questions? Submit a request