Password protect Parent and Allow subdirectory using .htaccess

To  password protect a directory use the following  entries in the .htaccess in the directory

AuthUserFile /path/to/.htpasswd
AuthName "This is Hasten secret area"
AuthType Basic
require valid-user

To create .htpasswd file  use the following command

htpasswd -c .htpasswd  <user>

You will be prompted for password . Once it is done, the file will be created.

Now the directory is password protected.

Allow Subdirectory

The restrictions imposed on a parent directory will be applicable to the subdirectory too. To override this we need to specify it in .htaccess in the subdirectory. To disable password proptection on subdirectory , add the following in .htaccess

Allow from all
Satisfy Any




Related posts:

  1. Redirecting a domain to a subfolder using .htaccess.
  2. One website in Plesk is asking for user name and password. What is the solution
  3. How to recover forgotten plesk password from a Linux or Windows Dedicated or VPS server
  4. Howto reset lxadmin password ?
  5. What is a Zombie Process?

One Response

Thanks, I was trying to figure this out for a while! Trying to allow access to a protected folder in Plesk. I simply created the .htaccess file like your example in the subfolder and it works. Thanks a lot.

Comment Form

About this blog

This blog, acts as a knowledge repository for the world and is unofficial! Anything we find interesting in the cyber world will go here. Most cases, this blog will reflect the happiness of our staff in reaching successful solution to an issue (s)he worked on. A reference for other fellow SAGEs who come across similar issues later