I was wondering if there is a way to make urlManager rules recursive. What I want to happen is the user will click on the Projects option in the menu, which links to projects/. I have a rule that says to send projects/ to posts/project (commented out in code below), which should then forward to post/index with tag=project.
The problem comes when it converts projects/ to posts/project; it looks for a posts controller instead of looking in rules again.
I tried to add a rule that says to forward all projects/ requests to post/index with tag=project, which works, but when I use $this->createUrl(‘post/index’) or $this->createUrl(‘post/’), it always produces a link to projects/.
I also tried moving the order, but that didn’t do anything. Any suggestions?
... 'urlManager'=>array( 'urlFormat'=>'path', 'rules'=>array( 'post/<id:\d+>/<title:.*?>'=>'post/view', 'post/<id:\d+>'=>'post/view', 'posts/<tag:.*?>'=>'post/index', 'projects/'=>array('post/index', 'defaultParams'=>array('tag'=>'project')), // works $this->createUrl('post/index') or $this->createUrl('post/') produces link to projects/ //'projects/'=>'posts/project', // doesn't work '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', ), ), ...