[thelist] Apache - alternative paths

Max Schwanekamp lists at neptunewebworks.com
Thu Dec 14 11:11:15 CST 2006

Mark Howells wrote:
> Is it possible to configure Apache so that it looks for a file in a  
> certain location and, when it doesn't find it, source it from a  
> default folder?
> e.g.
> http://test.com/myfile.gif
> Search in /root/images/myfile.gif (not found)
> Serve file /root2/images/myfile.gif

You could use a 404 handler to do that.  Traditionally a custom 404 page 
is a static page, but there's no reason it cannot be a script in your 
language of choice.  David Sklar has a decent intro:

In your case, maybe you would load an array from config or db containing 
the default fallback locations and if the request matches one of these 
serve that up, and if not give an actual 404 response.

Max Schwanekamp

More information about the thelist mailing list