This is a little bit of an involved process. Chances are that if you don't have any ideas on how to do it, it might end up being a little over your head. You need to parse the $_SERVER['REQUEST_URI'] and compare it against a list of pre-specified routes. To allow for variables, use some kind of identifier for variable names ( a colon is common, like blog/view/:year/:month/:day), then make use of regular expressions to parse out the values.
Personally I would recommend using an existing MVC framework. I use FUSE. The route syntax looks like:
FuseURIRouter::route_connect( 'Recipe/view/:id', array(
'controller' => 'Recipe',
'action' => 'view',
'requirements' =>
array( 'id' => '/\d+/' )
)
);
*note: REQUEST_URI is not set by IIS, so you need to set it manually from other variables. Google has more information on how to do that, if you need to support IIS.
-Jim Keller
http://www.contextsolutions.net