You can password protect a folder by adding a .htaccess file with the following lines:
|
1 2 3 4 |
AuthName "Secret Space" AuthUserFile path/to/the/user/password/file AuthType Basic require valid-user |
Sometimes, when the password protected folder is a sub-directory and, the parent folder has a .htaccess file that uses the rewrite engine, you may get a 404 Page Not Found error when you browse the protected sub-folder. WordPress users will especially notice this when they try to password protect a sub-folder. One way to solve this issue is to add 2 lines to the beginning of the protected folder’s .htaccess file. So, the final file will look like this:
|
1 2 3 4 5 6 |
ErrorDocument 401 default ErrorDocument 403 default AuthName "band" AuthUserFile /home/wwst/.htpasswds/public_html/band/passwd AuthType Basic require valid-user |
This should solve the page not found errors!
Incoming search terms:
- magento password protect directory
- password protect directory prestashop
Tagged with: .htaccess • page not found • password protect • protect folder • wordpress
Filed under: Linux • Linux Tips • Tips and Tricks • wordpress
Like this post? Subscribe to my RSS feed and get loads more!




Leave a Reply