Force custom routes?

Is there a way to force custom routes?

I have this in my config:


'urlManager'=>array(

			'showScriptName' => false,

            'urlFormat' => 'path', 

            'rules' => array(

                'book/<id:\d+>/<slug:.*?>'=>'books/view',

            ),

        ),

But on some places from the crud it will still redirect to

/books/view/id

instead

/book/id/slug

Is there a way to force all routes to only accept the custom route else redirect with a 301 error?

Yes. http://www.yiiframework.com/doc/api/CUrlManager#useStrictParsing-detail

Mmm when I turn this on all url’s that are not defined give 404… Is there a way to just feed the custom urls to the DetailView widget and Grdview widget?

You should redirect to:




$this->redirect(array('books/view', 'id' => 10, 'slug' => 'mybook'));