goodmorning,
i have yet another problem with my website. i've developed a site that is similar to yellowpages.com (well not so similar but is just to have an idea)
now they asked me to make some crazy stuff with SEO and url-rewriting.
i'll start with my main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'surf/category/<id:[0-9]+>/page/<page:[0-9]+>'=>'naviga/categoria/',
'surf/subcategory/<id:[0-9]+>/page/<page:[0-9]+>'=>'naviga/sottocategoria/',
'surf/page/<page:[0-9]+>'=>'surf/',
'contact' =>'site/contact/',
'write-mail/<id:[0-9]+>' =>'site/contact/',
'privacy' =>'site/page/view/privacy',
'register'=>'site/page/view/register',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
now the request ..... T_T they want that the url will be something like that:
http://domain.com/category-name/ instead of http://domain.com/surf/category/3 (ex.)
http://domain.com/category-name/sub-category-name/ instead of http://domain.com/surf/subcategory/3
http://domain.com/category-name/sub-category-name/society-name/ instead of http://domain.com/detail/2
and obviously the rest of the link must be working with the last 3 controller rules.... somebody can help me??? i'm in a really tight spot....they'll kick my ass if i can't find a solution for tuesday.....
T_T
thanks in advance for the help.
What your after is out of the scope of yii's basic regex based url rules. What you will need is your own custom url rule classes.
In config:
In protected/components/CategoryUrlRule.php:
Using Custom URL Rule Classes