There's many ways to go about this, but here's a simple one
Put this in a .htaccess file
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* script.php [L]
Your php script can now parse $_SERVER['REQUEST_URI'] to get the needed info.
That will map ALL requests to files or directories which don't exist to your script. This can be too much, as it now essentially gives this script the burden of being the 404 error page too. Solutions:
Turn off rewriting in all other directorys, by placing another .htaccess file in each dir
Otherwise, you will need to devise some type of pattern in the url which can be matched with a regular expression. Basically find the distinctions between these fake folder urls, and urls which actually map to a real file or dir.
Bookmarks