Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've the following in my httpd.conf file:

<Directory "/www">
    Options Indexes FollowSymLinks
    AllowOverride AuthConfig FileInfo Options=Indexes,Limit
    Order allow,deny
    Allow from all
</Directory>

Next, I've a directory ChatLogs located in server root, with a .htaccess file defined as follows:

Allow from all
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /www/.htpasswd
AuthGroupFile /dev/null
Require valid-user

and when I try to access the directory, I get a 500 server error with the following in server logs (10.109.1.92 is my intranet IP):

[alert] [client 10.109.1.92] /www/ChatLogs/.htaccess: allow not allowed here

I understand that this is because of the following statement in .htaccess file:

Allow from all

but could someone explain why is the Allow directive not allowed? I want later to restrict access to certain IP ranges; and would prefer if it can be placed in singular directories instead of setting them in httpd.conf file.

share|improve this question

migrated from stackoverflow.com Oct 4 '13 at 10:53

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 2 down vote accepted

Because you've got a comma before Limit. That makes apache parse it as though it were part of Options rather than a separate override. Think of it like this:

AllowOverride 
               AuthConfig
               FileInfo 
               Options=Indexes,Limit

What you want is instead

AllowOverride AuthConfig FileInfo Limit Options=Indexes

There's more information at the Apache core documentation.

share|improve this answer
    
But commas are allowed as per the documentation here –  hjpotter92 Oct 4 '13 at 12:35
1  
Commas are allowed between options, to create a list of options. Limit is a separate directive and should not be part of the list of options. I don't know how to put it any clearer than that. –  Jenny D Oct 4 '13 at 12:58
    
<strike>Isn't the same true for Indexes as well?</strike> Never mind that. I understand now. :) I have had confused this with AllowOverride Directive lists. –  hjpotter92 Oct 4 '13 at 13:54
    
I'm glad you got it working! It can be a bit confusing with having a list within a list :-) –  Jenny D Oct 5 '13 at 19:26

In the Directory section try changing this line:

AllowOverride AuthConfig FileInfo Options

to this:

AllowOverride All
share|improve this answer
    
Sorry! There was a minor mistake in copying the contents of httpd.conf! The correct directive was AllowOverride AuthConfig FileInfo Options=Indexes,Limit –  hjpotter92 Sep 26 '13 at 8:55
    
Sure np, just replace your AllowOverride line with AllowOverride All –  anubhava Sep 26 '13 at 8:57
    
Yeah, I know it'd work with AllowOverride All. but the host access is controlled by the Limit directive. I'm just curious as to why is it not working. –  hjpotter92 Sep 26 '13 at 9:01
    
Sorry I am not really an expert in that area. You may need to search that answer on Google. –  anubhava Sep 26 '13 at 9:07
    
That will allow all overrides, including some they may not want. –  Jenny D Oct 4 '13 at 11:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.