Alex
Alex

Reputation: 35118

Deliver dummy image for not existing files in Apache

We are developing web shops that are based on a lot of images.

On our local test system we do not have those images for performance reasons.

No when I open a webpage, logs and firebug are cluttered by a lot of 404 errors.

How can I configure Apache to just deliver a dummy image for cases where the image does not exist?

Upvotes: 1

Views: 143

Answers (1)

PiTheNumber
PiTheNumber

Reputation: 23562

You can define a error document (more in the manual):

ErrorDocument 404 /error404.php

From your error404.php you can use getenv(“REQUEST_URI”) to get the name of the requested page. If it's a image you push out your dummy image. Otherwise you show your normal error page.

Upvotes: 1

Related Questions