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

We currently have a .htaccess file which looks like

<Limit GET POST>
order deny, allow
deny from all
allow from localhost
allow from ...

This applies currently to the whole directory. I would like to exclude one file in the directory from these rules so that it could accessed from the whole Internet. Any ideas?

share|improve this question
up vote 1 down vote accepted

(I'm not sure what the purpose of the Limit directive is here. It has the effect of allowing all clients to use these HTTP methods: PUT, DELETE, CONNECT, OPTIONS, PATCH, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, and UNLOCK. Wouldn't you rather wish to restrict all methods, not just GET and POST?)

You could use the Files (or FilesMatch) directives like so:

<Files "foo.html">
    allow from all
share|improve this answer

Use mod_rewrite and [F] flag:

RewriteEngine On
RewriteCond %{REMOTE_ADDR}  !
RewriteCond %{REMOTE_ADDR}  !
RewriteRule !^foo$ - [F]
share|improve this answer

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.