Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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
share|improve this question
up vote 4 down vote accepted

What you need there is FilesMatch:

<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


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.