P
P
Pavel Gogolinsky2014-06-24 16:09:16
Yii
Pavel Gogolinsky, 2014-06-24 16:09:16

How not to duplicate url using yii?

Included in Yii CNC.
Now you can go to the main page
If I write $this->createUrl('site/index'); then in the url I get sitename.ru/site/index.
How to setup urlManager so that $this->createUrl('site/index'); get on sitename.ru?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grag, 2014-06-24
@Grag

Just enter an alias

array(
    // стандартное правило для обработки '/' как 'site/index' - это ваше
    '/' => 'site/index',
 
    // стандартное правило для обработки '/login' как 'site/login' и т.д.
    '<action:(login|logout|about)>' => 'site/<action>',
 
    // своё правило для URL вида '/Производитель/Модель'
    array(
        'class' => 'application.components.CarUrlRule',
        'connectionID' => 'db',
    ),
 
    // стандартное правило для обработки 'post/update' и др.
    '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),

or just say no
site/index
but just a slash
/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question