Following on from protecting directories using .htaccess
, you may find that (in some cases), you want to access a subdirectory that is password protected without a password. For example, you want static files (javascript and css files, etc) to be accessible without a password so others can access those files too.
The easiest way to do this is using .htaccess
again. However, this solution is easier than setting up the password protected directory in the first place.
All you have to do is create a new .htaccess file in the subdirectory you don’t want password protected and add one line to it:
Satisfy any
This will allow that subdirectory to be accessible without the password required to access the parent directory.
is this possible to protect sub-folders instead of root folder ?
Yes. You just need to put the .htaccess file inside of the sub-folder.