httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matt farey <matt.fa...@gmail.com>
Subject Re: [users@httpd] Render an image for a 404 on images
Date Wed, 07 Mar 2007 17:47:05 GMT


philguillard wrote:
> Hi,
>
> Thank you guys.
> Unfortunately i didn't succed with the Directory directive soluion
> because of some other rewrite rules.
> But with mod rewrite i succeded doing this:
>
> RewriteCond   %{REQUEST_URI} /img/folder/(.*)\.jpg$
> RewriteCond   /usr/local/apache2/htdocs/%{REQUEST_URI} !-f
> RewriteRule   ^(.+)    /img/folder/no.gif
>
you can modify this if you want to make sure you always serve the 404
image with the same mimetype as the failed image.

RewriteCond   %{REQUEST_URI} \.(jpg|jpeg|gif|png)$
RewriteCond   %{REQUEST_FILENAME} !-f
RewriteRule   .*   /img/folder/no.%1


>
> Regards,
>
> Phil
>
>
>
> why not have a rewrite that says if the request is an image, and is not
> present, then redirect to the 404 images, you can capture the type of
> extension in the rewrite and direct to the appropriate pre-rendered
> image.
>
> philguillard 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.
> >>
> >> Regards,
> >>
> >> Phil
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >>
> >>
>
>
> -- Matthew Farey Web App Sec. 25 The Polygon, Southampton, Hants, SO15
> 2BP, UK Phone +44(0)2380 631449
>
> ---------------------------------------------------------------------
> 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
>
>

-- 
Matthew Farey



---------------------------------------------------------------------
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