Quantcast
Viewing latest article 9
Browse Latest Browse All 11

Answer by Dennis for Password protect a specific URL

the solution above is too busy and messed up a bit.. I go for simplicity and clarity like this

<Files "protected.html"> AuthName "Username and password required" AuthUserFile /home/fullpath/.htpasswd Require valid-user AuthType Basic</Files>

The above is to be put into your htaccess file where the "protected.html" is the file you want to protect (it can be anything you wish, for example myphoto.jpg or a document.zip, just re-name it to your preference). The AuthUserFile is the full path to your password file. You are done.

Although you may have to make sure the prerequisites for this are set. AllowOverride and AuthConfig are required in Apache directory tag configs for the code to work but normally it is pre-set out of the box so you should be safe and fine unless you are making your own custom build.


Viewing latest article 9
Browse Latest Browse All 11

Trending Articles