Page 1 of 1

Exception for allow/deny directive possible? [SOLVED]

Posted: Tue Feb 08, 2005 3:56 pm
by tomfra
Let's say I have a .htaccess file similar to this:

Code: Select all

Order Deny,Allow
allow from 123.132.123.132
allow from 123.132.123.133
Deny from all
This will effectively restrict access to the website (or a directory and subdirs) to only the above listed IPs. Request for any file coming from IP not listed there will get a 403 Permission Denied Error.

But with this settings in place, I'd like to make an exception for one file. In other words, one particular file, let's say "exception.html" should be available to any request from any IP unlike the other files.

Is this possible?

Thanks!

Tomas

Posted: Tue Feb 08, 2005 4:17 pm
by Buddha443556
Might try a file directive:

Code: Select all

<Files ~ "exception.html">
Order allow,deny
Allow from all
</Files>
Have no idea if this will actually work ... never tried it. I'm also thinking Apache so your mileage may vary.

Posted: Tue Feb 08, 2005 4:41 pm
by tomfra
Yes, it did the trick!

Thanks a lot!

By the way, you have a typo in your sig file - "Kenned" instead of "Kennedy".

Tomas

Posted: Tue Feb 08, 2005 4:56 pm
by tomfra
One more question if you don't mind ;)

Is it possible to use one Files directive section & list multiple different filenames? I am having difficulty with finding this info in the Apache manual...

Tomas

Posted: Tue Feb 08, 2005 4:59 pm
by feyd
http://httpd.apache.org/docs/mod/core.html#files

talks about it right there. FileMatch may be a better option though (look before the <Files> directive.

Posted: Tue Feb 08, 2005 10:05 pm
by Buddha443556
Thanks Tomfra, I fixed my sig. :oops:

Can use regular expression with <files> too. Actually that the one I used above with the ~ character.