hi,
i have a static page (site/page/view/contact), something like in the app skeleton. but i wan’t to have a pretty url for this page. what rule should I put into urlManager?
regards,
augustin
hi,
i have a static page (site/page/view/contact), something like in the app skeleton. but i wan’t to have a pretty url for this page. what rule should I put into urlManager?
regards,
augustin
If you want
http://site.com/page/contact.html
'urlManager'=>array(
'urlFormat'=>'path',
'urlSuffix'=>'.html',
'showScriptName' => false,
'rules'=>array(
//pages
'page/<view>'=>array('site/page'),
'index'=>array('site/index'),
...
OR if you want
'urlManager'=>array(
'urlFormat'=>'path',
'urlSuffix'=>'.html',
'showScriptName' => false,
'rules'=>array(
//pages
'index'=>array('site/index'),
'login'=>array('user/login'),
'logout'=>array('user/logout'),
'registration'=>array('user/registration'),
'recovery'=>array('user/recovery'),
'<view>'=>array('site/page'),
...
it works,
thx
one more question:
and what if I want to have a different name (different than the file name), is it possible to do?
i have the same problem - i found that thread through my search of static url rewrites… basically i want to define any name for my url
currently i use:
'' => array('page/get', 'defaultParams' => array('key'=>'start')),
'my_imprint' => array('page/get', 'defaultParams' => array('key'=>'impressum')),
which will display mypage.com/?key=impressum and mypage.com/?key=start on my homepage when i use CHtml::link() to generate the urls…
when I rearange the rules to:
'my_imprint' => array('page/get', 'defaultParams' => array('key'=>'impressum')),
'' => array('page/get', 'defaultParams' => array('key'=>'start')),
it will display my_imprint?key=start
and my_imprint?key=impressum
BUT i can already visit mypage.com/my_imprint perhaps it’s also a problem with CHTML::link() ?