jonazu
(Jonas Zumkehr)
1
Hi,
I’m trying to remove site/index in the links created by CMenu. I assume I have to add a rule to my urlManager rules?
Here the CMenu item I want to create:
array('label'=>'Homepage', 'url'=>array(''),),
urlManager rules:
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
The URL I get is www.domain.com/site/index but I want to have the URL www.domain.com.
Thanks for your help
Jonas
softark
(Softark)
2
Hi Jonas, welcome to the forum.
Try this:
''=>'site/index',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
I think this is a bit cleaner:
[list=1]
[*]Set CWebApplication.defaultController to ‘site’ (this is actually the default. But just in case…)
[*] Insert the following URL rule:
'<controller:\w+>'=>'<controller>/index',
[/list]
jonazu
(Jonas Zumkehr)
4
@softark: Thank you, this worked!
@Da:Sourcerer: I tried your solution also, but this results in www.domain.com/site