Hide GET parameter from URL

后端 未结 5 1444
故里飘歌
故里飘歌 2020-12-18 08:44

How to hide URL GET parameters (http://domain.com/MyFirstYii/page?view=about). I\'ve searched lot of posts. They all are saying about rewrite and URL manager, but i couldn\'

5条回答
  •  萌比男神i
    2020-12-18 09:36

    Add this url rule to the top of your url rules:

    'page/' => 'user/page'
    

    I'm assuming the next:

    • controller name: UserController
    • action name: actionPage

    If my assumptions are wrong, please provide the right controller name and action name, so I can fix the answer.

    UPDATE: fixed controller name based on comment

    UPDATE2:

    If you want this to work for all actions in your controller, use:

    '/' => 'user/'
    

提交回复
热议问题