Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.htaccess and authentication?

Status
Not open for further replies.

streetbmx

Programmer
Dec 6, 2001
16
0
0
US
Ive read through previous threads about getting password protection for directories useing .htaccess and .passwd files. I am curious if anyone has gotten it to work on Windows? I've tried, and seems like Apache is just ignoring .htaccess
 
Look for

# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride All

in your httpd.conf file. I think it's set to None by default, changing it to all should allow you to protect your dirs. Hope this helps.
 
Hi,

As polarz says, you need to allow overrides for the directory concerned in httpd.conf (or just globally if you really wish)

You'd need something like :

<Directory &quot;C:/Program Files/Apache Group/Apache/htdocs/test&quot;>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Then in the .htaccess file in that same directory :

AuthName &quot;ABC&quot;
AuthType Basic
AuthUserFile &quot;C:/Program Files/Apache Group/Apache/auth/.htpasswd&quot;
require valid-user

(you should be able to use either forward or backslashes)

If you then test it and you get a login prompt with realm 'abc' (or whatever) then its reading the .htaccess file. If not thats the first problem.

If the login prompt appears but the userid / passwords don't work then it probably can't find the .htpasswd file. Double check the path .

Hope this helps
 
ah ha, I found out the problem before i got any replys. I had the AllowOverride None. thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top