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?

link|improve this question
feedback

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>
link|improve this answer
feedback

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]
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.