Showing posts with label Password protect Parent and Allow subdirectory using .htaccess. Show all posts
Showing posts with label Password protect Parent and Allow subdirectory using .htaccess. Show all posts

Password protect Parent and Allow subdirectory using .htaccess

0 comments
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