Forum Moderators: phranque

Message Too Old, No Replies

Password protected directory not working

         

uxbod

12:41 pm on Jan 23, 2011 (gmt 0)

10+ Year Member



Hi,

I have a reports directory I wish to secure and have created the necessary .htaccess file:

AuthUserFile /www/security/somedomain_access
AuthType Basic
AuthName "Restricted Access"
Require user someuser

I believe my virtual host config is correct:

<VirtualHost *:80>
ServerAdmin webmaster@somedomain.co.uk
DocumentRoot "/www/somedomain.co.uk"
<Directory /www/somedomain.co.uk/>
AllowOverride All
</Directory>

ServerName www.somedomain.co.uk
ServerAlias somedomain.co.uk

ExpiresActive On
ExpiresByType text/html "access plus 30 seconds"
ExpiresByType text/css "access plus 2 weeks"
ExpiresByType text/javascript "access plus 2 weeks"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"

AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript application/javascript application/xml

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

DeflateCompressionLevel 6

Header append Vary User-Agent

ErrorLog "logs/www.somedomain.co.uk-error.log"
CustomLog "logs/www.somedomain.co.uk-access.log" common
</VirtualHost>

Though when I navigate to [somedomain.co.uk...] I am never prompted for a user/password If I add some random text to .htaccess then I do receive a Server Error so the file is being processed. Thoughts please ?

uxbod

12:44 pm on Jan 23, 2011 (gmt 0)

10+ Year Member



Oh, and in httpd.conf I have set the following for the top level:


<Directory "/www">
Options -Indexes -MultiViews -FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

jdMorgan

12:02 am on Jan 25, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will need at least "AllowOverride AuthConfig" in your http.conf if you want your auth directives to have any effect in .htaccess files.

For each Apache directive, see the line in that directive's documentation header that says "Override". It specifically lists the "Overrides" needed to use that directive in .htaccess files (if the preceding "Context" line includes the .htaccess context as a permissible-use context for that directive.)

Jim