Print

Print


On Wed, 1 Jul 2009, Godmar Back wrote:

> How can I write an .htaccess that's path-independent if I like to exclude
> certain files in that directory, such as index.html?  So far, I've been
> doing:
>
> RewriteCond %{REQUEST_URI} !^/services/tictoclookup/standalone/index.html
>
> To avoid running my script for index.html.  How would I do that?  (Hint: the
> use of SERVER variables on the right-hand side in the CondPattern of a
> RewriteCond is not allowed, but some trickery may be possible, according to
> http://www.issociate.de/board/post/495372/Server-Variables_in_CondPattern_of_RewriteCond_directive.html)

If you're not dealing with further subdirectories, where the index.html 
file should _not_ be exempted it's easy -- just leave out the path, 
and anchor it to the end of the string:

 	RewriteCond %{REQUEST_URI} !/index.html$

(this wouldn't work if 'index.html' if PATH_INFO or QUERY_STRING is sent, 
but then just don't anchor it, or give it a more complex regex to deal 
with the alternate forms)

-----
Joe Hourcle