Question

I've enabled url management within my YII project. Most of the links are working, however i have a few links which have an id which is obtained from the database, these links aren't working.

localhost/project/site/contact <-- This link is working

localhost/project/site/page&view=contentpage&id=1 <-- This one isn't.

How can i get this link to behave as a seo-friendly url?

These are my current rules within the urlmanager in my main.php file.

    'urlManager'=>array(
        'urlFormat'=>'path',
                    'showScriptName'=>false,
                    'caseSensitive'=>false, 
        'rules'=>array(
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

        ),
             ),   

Thank you so much already!

Edit- I have now changed the url to have a ? instead of a &. The link is now working, but how do I make it seo-friendly, any idea's? Thanks! :)

Was it helpful?

Solution

rule: '<controller:\w+>/<action:\w+>/<id:\d+>/*'=>'<controller>/<action>',

url:localhost/project/site/page/1/view/contentpage

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top