Routes inconsistencies #565

Closed
rakanalh opened this Issue Mar 29, 2012 · 1 comment

Comments

Projects
None yet
3 participants

I am using the following routes in my config:

'rules'=>array(
    'backend'=>'backend/dashboard/index',
    'backend/<_c>'=>'backend/<_c>/index',
    'backend/<_c>/<_a>'=>'backend/<_c>/<_a>',
    'backend/<_c>/<_a>'=>'backend/<_c>/<_a>',
    'backend/<_m>/<_c>/<_a>/page/<_page>'=>'backend/<_m>/<_c>/<_a>/page/<_page>',
),

When using createUrl inside the view:

<?php echo Yii::app()->createUrl('/users/users/index')?>

The URL is generated as follows http://localhost/yii_proj/backend/users/users/index.

However, when using the CLinkPager, the pages URLs are generated as follows:
http://localhost/yii_proj/backendusers/users/index/page2

Notice that "backend" and "users" are not separated by forward slash

How come those exist?

Owner

cebe commented Mar 30, 2012

The array values of your config array are not valid routes.
A route has to be controller/action or /module/controller/action

last line should be:
'backend/<_m>/<_c>/<_a>/page/<_page>'=>'/<_m>/<_c>/<_a>',

http://www.yiiframework.com/doc/guide/1.1/en/topics.url#user-friendly-urls

@samdark samdark closed this Mar 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment