module routes not working

my defaultController is a PageController with a viewAction

www.mysite.com/hello-world displays a page from my database




'urlManager' => array(

    'urlFormat' => 'path',

    'showScriptName' => false,

    'rules' => array(

        '<slug:[a-zA-Z0-9_-]+>' => 'page/view'

    ),

),



other Actions like page/create or page/update are working

I created a module "admin", but www.mysite.com/admin ends up in a 404-Error

what is the missing pattern in rules?

www.mysite.com/admin doesnt work

www.mysite.com/admin/default works

The rule


'<slug:[a-zA-Z0-9_-]+>' => 'page/view'

will catch ‘www.mysite.com/admin’ and dispatch it to ‘page/view’, because ‘admin’ mathces ‘[a-zA-Z0-9_-]+’.

‘admin/default’, ‘page/create’, ‘page/create’ and many others with ‘/’ in them will not fall into the pattern and eventually applied the default rule, and will be routed correctly.

So, the quick and dirty fix may be:




'urlManager' => array(

    'urlFormat' => 'path',

    'showScriptName' => false,

    'rules' => array(

+       'admin' => 'admin/default',

        '<slug:[a-zA-Z0-9_-]+>' => 'page/view'

    ),

),



You might want some cleaner way. :)

indeed, if there is a cleaner way? B)

now my code is




'<module:\w+>' => '<module>/default',

'<slug:[a-zA-Z0-9_-]+>' => 'page/view',



Well, I don’t know. I’m using a much more messy set of rules than yours. :P

BTW, there’s one thing I’m concerned about. An article with a title without ‘-’ or ‘_’ will fail with your current rules. For example, ‘www.mydomain.com/hello’ will fall into the first rule and end up in 404. Isn’t there any chance that your article will have that kind of title?