I'm trying to implement URL routing into my web app but struggling, i've followed the mvc structure so urls are /controller/class
i want to be able to change '/profile/edit_profile' to '/edit-profile'.
I've done something similar in CodeIgniter in routes.php i would add
$route['edit-profile'] = 'profile/edit_profile';
but can't think of the logical way to code this
There are essentially two ways of doing it:
-A routing table, mapping each possible route to a controller/controller acton.
-Convention over configuration: Taking a best guess approach and having a standardised URL format for routing. e.g. /controller-action/foo/bar maps to $controller->action('foo', 'bar');
I wrote about this in some detail here: http://r.je/mvc-php-front-controller.html