Q:

Disallowing routed URLs

I am working on a personal MVC framework including a router for the URLs.
At the moment I have a PagesController and a 'sitemap' view. So I can go to url.com/pages/sitemap/
I have also set up URL Route for "/info/{page}/". I've done this for static pages that I want to have 'info' in their URL. This also works for sitemap.
Then, as intended, I have mapped /sitemap/ to the sitemap page as well.
I only want /sitemap/ to be a valid resource, what would be the best way to disable/redirect the other URLs

A:

It all depends on the implementation of your router. If you have access, in the controller, to the original URL, you compare it and issue a redirect if needed:
class PagesController {

    function sitemap($request) {
        if ($request->url == '/info/sitemap/')
            $this->response->redirect('/sitemap/');

        //regular processing here
    }
}

EDIT
Another option, if your rules are regex-based, to add an "exclude" pattern, that would make /info/sitemap/ not match the /info/{page}/ pattern.
Something along the lines of :
$router->add(array(
    'url' => '/info/(?<action>.*)/',
    'controller' => 'PagesController',
    'exclude' => '(?:sitemap)',
));

