.htaccess index.php

Hi all,

I want to password protect a directory that uses index.php as the main index file. I’ve updated the .htaccess to include

DirectoryIndex index.php

but I keep getting a 404 error whenever I try to access the directory. There is no pop-up for a username or password, and index.php contains no errors. What the file does is connect to an external MySQL database. can anyone help me figure out what is going wrong?


Maybe if you posted the contents of your .htaccess file we could see if there is an obvious problem.

The .htaccess entries for authentication )password protection) should have no bearing on, and should not be effected by, any index entries. Additionally, there is no need to make any modifications for index.php, and that file is already searched for, and loaded if found, by DH default apache installation.


The contents are:

AuthType Basic
DirectoryIndex index.php index.html
AuthUserFile /home/domain/domain.com/pwProtected/.htpasswd
AuthName "Login Information"
require valid-user