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

For poorly configured Apache servers you can have to do something like this to deny access to the .htaccess file:

<Files .htaccess>
order allow,deny
deny from all
</Files>

Now is it possible to use a wildcard in the filename? I would like to deny access to all system files (.* - any file that it's filename starts with a dot). I would like to know if the following would work for what I want:

<Files .*>
order allow,deny
deny from all
</Files>
share|improve this question

1 Answer 1

up vote 4 down vote accepted

What you need there is FilesMatch:

<FilesMatch "^\.">
    [config]
</FilesMatch>

(The pattern is a regexp, rather than a glob, though).

More Info here

share|improve this answer
    
Would <FilesMatch "^\."> be better? –  Activist Jul 21 '11 at 17:51
    
Actually, yes. My regex \..* doesn't anchor at the start of the line, which would be pretty messy for most web sites :) Fixed. –  SmallClanger Jul 21 '11 at 18:09
    
Yeah it's what I tought ;) –  Activist Jul 21 '11 at 18:12

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.