I wonder if anyone knows if there's a way to configure Apache so that the url http://myurl.com/clips/song1.mp3 makes Apache fetch song1.mp3 in either directory1 or directory2?
Thanks in advance!
-Alex
|
I wonder if anyone knows if there's a way to configure Apache so that the url http://myurl.com/clips/song1.mp3 makes Apache fetch song1.mp3 in either directory1 or directory2? Thanks in advance! |
||||
|
|
|
There are a couple of ways you can accomplish this. One as has been suggested is to simply write a PHP page called The other option I've utilized in the past was to determine which directory (directory1 or directory2) was the primary and make 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. |
|||
|
|
There's a number of ways to handle it. The most straight forward is to have 'clips' be a CGI or other script that looks at the PATH_INFO sent in, and then looks in the directories you want. ... and for the less straight forward ... make 'clips' point to 'directory1', then add a 404 handler for that directory that will look in directory2, adjusting the response if it finds the file. |
|||
|
|
|
Using .htaccess, mod_rewrite, and php I've done this before. .htaccess looks like this, for example:
In your PHP script, you would get the i variable and strip path info:
Sanitize $file to prevent anyone from reading any file on the system. Then use PHP expressions to search and see which directory, if any, to serve up. You can also do any kind of tracking or processing via this php script. |
|||
|
|