How can I make Apache look in 2 separate directories with one common url?
There are a couple of ways you can accomplish this.
One as has been suggested is to simply write a PHP page called clips.php
and have Options +MultiViews
in either the <Directory>
declaration in the httpd.conf
file or in the .htaccess
file in the DocumentRoot directory where the clips.php
is located. I use this method to handle my GPG Key policy manager using PATH_INFO
to control multiple features through the same PHP file. You can then just have it parse PATH_INFO
for the filename being requested then look in either directory for the file to output back to the client being sure to set the proper header()
functions for content before beginning to stream the file.
The other option I've utilized in the past was to determine which directory (directory1 or directory2) was the primary and make /clips/
an Alias
for that directory. Then setup a mod_rewrite
rule that checks for the files existence in the other directory and have Apache hand off that copy. I've used this more in the case where I need to override and existing file in a directory, usually overriding a file with a newer copy that is in a web application.
Both suggestions depend on whether you're scripting or your configuration modification skills are stronger. Creating the PHP file might be the more versatile means to accomplish this but it is by far not the only means available to accomplish the same task.
Besides creative use of mod_rewrite you might want to look into using unionfs to merge multiple directories at filesystem level. In any case, it is a good idea to use "EnableSendfile off" whenever you serve thorugh FUSE.