[Web4lib] .htaccess help?
Micah Stevens
micah at raincross-tech.com
Sun Apr 1 16:28:19 EDT 2007
DirectoryIndex has nothing to do with password protection. Your line is
merely telling Apache that unless otherwise specified, the server should
load index.php when people go to that folder.
If you specify index.php explicitly in the browser does it work? (sounds
like it does from your description)
Try putting 'Deny All' as the first line in this file. If you get a
'permission denied' error, then Apache is reading the .htaccess file
properly. If not, you may have a permissions issue with the .htaccess
file. You can configure the server to ignore these files too, so that's
a possibility, although be default this would not be the case.
If the Deny All works, erase all the lines in the file, and put in:
AuthType Basic
AuthName "a description of the area"
AuthUserFile /the/path/to/the/password/file
require valid-user
Replacing the 2nd and 3rd lines with the appropriate information.
Worst-case, this should at least pop up a window asking for user/pw.
You'll need to learn how to create a password file too, which Thomas
provided a good link to below.
I hope that helps.
-Micah
On 03/30/2007 09:10 AM, Thomas Dowling wrote:
> On 3/30/2007 11:28 AM, Junior Tidal wrote:
>
>
>> 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 and
>> displays the info into a webpage. Can anyone help me figure out what is
>> going wrong?
>>
>>
>
>
> [You are using Apache, right?]
>
> I think you have three separate issues here: setting up the directory
> index (which looks Ol Korrect here), setting up basic authentication for
> the password protection, and figuring your your 404 Not Found error.
>
> For the 404 problem, you may need to look at the server logs to see what
> the server is actually looking for (and not finding) when you ask for
> your directory.
>
> For the basic auth stuff, you first need to set up the password file
> with htpasswd, and then there's a handful of directives to go in you
> .htaccess file. <http://httpd.apache.org/docs/2.2/howto/auth.html> is a
> reasonably good tutorial.
>
>
>
More information about the Web4lib
mailing list