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'd like to filter access to certain files in apache. I want only CGI access. So I tried putting in vhost file:

<FilesMatch "\.cgi$">
 Order allow,deny
 Allow from all
</FilesMatch>

<FilesMatch "."> # All other files
 Order allow,deny
 Deny from all
</FilesMatch>

But the latter overrides it all.

Thanks

share|improve this question

migrated from stackoverflow.com Aug 25 '12 at 14:45

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

    
Does swapping the tags work? –  vpram86 Mar 2 '10 at 8:34
    
nope............ –  Himberjack Mar 2 '10 at 11:09
    
Probably a serverfault question.. –  PP. Mar 2 '10 at 11:46

1 Answer 1

I believe you need to swap the values in your Order directive as follows:

<FilesMatch "\.cgi$">
 Order Deny,Allow
 Allow from all
</FilesMatch>

<FilesMatch "."> # All other files
 Order Deny,Allow
 Deny from all
</FilesMatch>

This will by default deny all access for all files. Any file ending in .cgi will then be allowed. See the documentation on the Order directive for more info.

share|improve this answer

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.