I would like to use htaccess to allow access to the index file plus a few others in a directory (index.php) but require a user/pass for everything else in the directory. Right now I have:
AuthName "SomeServer"
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
Require valid-user
AuthType Basic
<FilesMatch "(index.php)|(login.php)">
Allow from all
Satisfy any
</FilesMatch>
This allows users to access index.php and login.php and denies the rest of the directory. However, whenever a user requests the directory without the index.php in the URL like:
http://www.example.com/dir
The user is prompted to login. However, if the user goes here:
http://www.example.com/dir/index.php
Then index.php is displayed without a login prompt.
What do I need to change to allow the user to go to http://www.example.com/dir and be directed to http://www.example.com/dir/index.php without prompting for a login while still requiring a login for anything else in the directory?
Update: not sure it matters, but I switched the authentication to use mod_auth_mysql. Still using the same section of my htaccess file and still facing the same problem.
You could try something like the following
Make some basic tests