Routing Question

Hello my prettys :)

Here’s what I want my application to do, but I’m not sure how to do it.

I think this could be possible with route rules…but not sure - Any ideas?

Yes, it’s possible. Rules are executed from top to bottom so you need to place controller-related rule upper and page-related rule lower.

I think I have figured it out… of course, time will tell.

But here’s what I did, if anyone else is wondering…







Update: No, this doesn’t work.

If I have the url … page_1 is what I was hoping to see used in the second rule uri.

It’s using the first rule instead… ie: it’s looking for the route page_1/index

I assume this is happening because page_1 matches \w+.

My rules will only work when I replace page_1 with page-1. ie: \w+ doesn’t match anymore so it moves onto the second rule…which does match.

I would be happy changing all of my url’s to include a dash between each word but what if the url only has one word? It will give the same problem as above.

Any ideas anyone?

I think the simplest way to make it work is to declare controllers explicitly (as their names rarely change):

'rules' => array(

	'<controller:(controller1|controller2|controller3|...etc)>' => '<controller>/index',

	'<uri:\\w+>' => 'pages/view',


Yeah that seems to work well.