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.

We currently have a .htaccess file which looks like

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

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
add comment

2 Answers

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
</Files>
share|improve this answer
add comment

Use mod_rewrite and [F] flag:

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

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.