How to setup Apache to redirect all requests under a certain path to a script?
I know I've seen something exactly like this done on Mediawiki, and I'm curious how they do it.
I want to implement a file browsing script on my web server. Basically I want to be able to have a URL like this: http://www.mysite.com/browse/path/in/the/filesystem So, basically I want a PHP script to run anytime anyone accesses something under the "browse" directory, that will be passed the URL. (example: accessing the above URL would present a customized view of /path/in/the/filesystem. (of course I would prepend a "virtual root" directory on the path so as to jail the script into a certain directory.) The goal obviously is to be able to just create a new folder in the filesystem, then be able to access it by going to http://www.mysite.com/browse/path/to/my/new/folder. I do want to have the script execute EVEN IF the folder doesn't exist, because 1) I might want to create some special cases, and 2) I want the script to be able to present its own error messages. (Again, Mediawiki does that - when you request an unknown article it asks you if you want to create it.) I know I can easily get the URL from PHP and extract the necessary parts. The only question I have is how do I setup Apache to direct all requests under a certain directory to a singular script? As I said, Mediawiki does things like: http://en.wikipedia.org/wiki/My_article So I'm guessing there's a single script that runs, in which they extract the article title from the URL and go from there. Just curious if anyone knows how they do that. Thanks FM |
Hi there,
Quote:
[X] Doc CPU |
All times are GMT -5. The time now is 11:59 PM. |