|
Home > Archive > Apache Server configuration support > January 2007 > LocationMatch - RegEx
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
LocationMatch - RegEx
|
|
|
| Hi,
Can someone help me with a regex to pass every image file except
some_file.gif in Apache ? The current directive I have is given below
-
<LocationMatch /some_url/.+\.(gif|jpg|png)$>
SetHandler default
</Location>
Thanks,
Kevin.
| |
| shimmyshack 2007-01-31, 7:22 am |
| On 31 Jan, 00:49, "Kevin" <kejos...@hotmail.com> wrote:
> Hi,
>
> Can someone help me with a regex to pass every image file except
> some_file.gif in Apache ? The current directive I have is given below
> -
>
> <LocationMatch /some_url/.+\.(gif|jpg|png)$>
> SetHandler default
> </Location>
>
> Thanks,
> Kevin.
what are you trying to do? do you mean you wish to parse one
particular gif, so you can have php in there save as a gif and esnd
back an image, one of those avatars which changes or something?
If so, consider using a rewrite that rewrites one particular gif onto
a php file but does it internally so that the url ends with gif but
the content is served from the script.
(rather than parsing a gif which is actually a code file, besides your
editor might not like the extension, and it will be more hassle for
you anyway)
| |
|
| Thanks for replying - the setup I have is a bit more complex and hence
I did not specify the details earlier. I have a Java application
server at the backend and want Apache (as front-end web server) to
serve static content. However, due to the way the application is
setup, certain gif files do not work if they are served by Apache.
Hence, I need a way to have Apache exclude a couple of these gif
images and process the remainder. I hope this helps explain my earlier
query.
Kevin.
| |
| shimmyshack 2007-01-31, 7:21 pm |
| On 31 Jan, 16:57, "Kevin" <kejos...@hotmail.com> wrote:
> Thanks for replying - the setup I have is a bit more complex and hence
> I did not specify the details earlier. I have a Java application
> server at the backend and want Apache (as front-end web server) to
> serve static content. However, due to the way the application is
> setup, certain gif files do not work if they are served by Apache.
> Hence, I need a way to have Apache exclude a couple of these gif
> images and process the remainder. I hope this helps explain my earlier
> query.
>
> Kevin.
heres how you get a reg exp for files you might want to do something
with,
http://httpd.apache.org/docs/2.2/mo...html#filesmatch
<FilesMatch "\.(gif|jpe?g|png)$">
</FilesMatch>
I suppose I was asking what are you trying to do, maybe I'm being slow
but I can't see _what_ you are trying to achieve, we know that the
files are being mangled, so are you just going to stop them from being
public? If you dont wish people to see them, then use.
<FilesMatch "\.(gif|jpe?g|png)$">
Order Allow,Deny
</FilesMatch>
this will stop them from being served, adjust your reg exp to suit.
|
|
|
|
|