, but the rules don´t work properly…when the second is active the rest not work and when disabled this work fine…now the url www.site.com/es/node/admin not work for me…What is the error ? Thanks
OK thanks, but the second rules when is active works fine, and the rest not work. in my node controller
/**
* Displays a particular model.
* @param string $slug the slug of the model to be displayed
*/
public function actionView($slug)
{
$this->render('view',array(
'model'=>$this->loadModelSlug($slug),
));
}
and
public function loadModelSlug($slug)
{
$slug_simple = explode('/', $slug);
$last_slug = end($slug_simple);
$model = Node::model()->findByAttributes(array('slug'=>$last_slug));
if($model===null)
throw new CHttpException(404,'The page does not exist.');
return $model;
}
but if is disabled the second rules the rest don´t work…more specifics rules. iam not understand …i need rules with the form controller/action
Because the second rule catches all paths that matches #^[a-z]{2}/[a-zA-Z0-9]+/[a-zA-Z0-9]+$# including paths like languageCode/yourControllerId/yourActionId or languageCode/yourModuleId/yourControllerId and once a rule has been matched all other rules are ignored.
Try to change the order of rules and write more restrictive regexes:
or wite a custom URL rule that checks if the category and slug exists in the database and returns false if not. (Still can be problematic when a category has the same name as one of your controllers).
ok…its true…you are right…the second rules match and ignore the other rules…but is a problem for me…why? because a have urls with the form
'<lang:[a-z]{2}>/<_c>/<_a>' => '<_c>/<_a>'
, that not have a category or slug and the controller/action is different of node/view …for example
en/node/admin
that belongs to admin dashboard…the main purpose is to have a category and slug in my site (like a cms), but i need the others too (I think)…ok…thanks and I try to solve this…best regards and thanks for your time.