[EMAIL PROTECTED] (Stefen Lars) writes:
> In the Apache config file, we have the following directive:
>
> SetEnvIfNoCase Referer "^http://www.oursite.com/" local_ref=1
>
> <FilesMatch ".(gif|jpg)">
> Order Allow,Deny
> Allow from env=local_ref
> </FilesMatch>
>
> We use this to prevent people from directly linking to .gif and .jpg
> files.
>
> However, we have to add more and more file types to the FilesMatch
> directive. Currently it looks like this:
>
> <FilesMatch ".(doc|zip|xls|exe|jpg|gif|png|psd|tif|tif)">
>
> However, this list continues to grow. And we can never be sure that
> every file type is included.
>
> It occurred to me that it would be better to say "do not serve any
> files except .htm, .html and .php files.".
>
>
> I have spent quite a long time with several regexes, but I am unable
> to create a regex that archives this seemingly simple talk.
>
How about this approach?
SetEnvIfNoCase Referer "^http://www.oursite.com/" local_ref=1
Order Allow,Deny
Allow from env=local_ref
<FilesMatch "\.(php|html?)$">
Allow from all
</FilesMatch>
I'd tighten up your regex slightly too. As it was it would match pretty
much any filename with those letters in it; The '.' matches any character
and it's not anchored to the end of the string.
-robin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]