Password Protect a single file using .htaccess

by Rekha 2008-08-05 09:12:51

* To password protect just a single file in a folder, use the following .htaccess file:


AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/usr/pwd
<Files "admin.php">
Require user hiox
</Files>


This will password protect just the admin.php file in the folder where you put the .htaccess file.

Password protecting more than one stuff:
* To password protect more than one file in the same folder, just create more <Files></Files> blocks within the same .htaccess file - for example:


AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/usr/pwd
<Files "admin.php">
Require user hiox
</Files>
<Files "index.php">
Require user hiox
</Files>



Tagged in:

2512
like
0
dislike
0
mail
flag

You must LOGIN to add comments