tags:

views:

51

answers:

2

I use router

Router::connect(
    '/articles/:id/:slug',
    array('controller' => 'articles', 'action' => 'view'),
    array(
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

BUT how to prevent user enter /articles/view/:id .I can make page /articles/view/:id become " NOT FOUND " ?

A: 
Router::connect(
    '/articles/view/:id',
    array('controller' => 'articles', 'action' => 'index'),
);
Dooltaz
I can make page /articles/view/:id become " NOT FOUND " ?
meotimdihia
would work, but just makes for an extra route to manage, and for cake to parse (more overhead)
dogmatic69
A: 

you are passing the slug, so just check that $this->params['slug'] isset and if it is not, redirect them to the home page.

dogmatic69