httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <jos...@slive.ca>
Subject Re: [users@httpd] Render an image for a 404 on images
Date Tue, 06 Mar 2007 15:53:11 GMT
On 3/6/07, philguillard <philguillard@gmail.com> wrote:
> Hi,
>
> I'd like to render a specific 404.gif file when the requested
> gif/png/jpg image is not found on the file system while other documents
> are still redirected to a 404.html document with "ErrorDocument 504
> /404.html" directive.
>
> Is there a way to do that in http.conf? I can do it within my
> application  (i use tomcat) but i think it is bad idea for performance
> reasons.

First you need to determine whether the request was for an image or
not.  If you can trust the file extension, you could use something
like
<LocationMatch \.(gif|png|jpg)$>
ErrorDocument 404 /nothere.gif
</LocationMatch>

But I have no idea how browsers will interpret an image returned with
a 404 status code.  In the case of an image embedded in an html page,
I wouldn't be at all surprised if they threw out the image and
displayed the broken-image icon.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message