How to specify a SEO friendly url like twitter www.twitter.com/<name> using YII framework

限于喜欢 提交于 2019-12-06 20:27:41

Edit the config file main.php with this

'components'=>array(

            .....

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

            ....

I think it is generated when you create a webapp with yiic-tool

Are you not able to achieve what you want by using the URL Manager? If not, can you post an example of what you have currently and what you'd like it to be?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!