URL address beautification: Urlmanager address Management (through the program to achieve the URL of the address beautification)
For example:
Original address: http://localhost/Project/app/index.php?r= Controller/method
New address: http://localhost/Project/app/index.php/Controller/method
-------------------------------
Practice:
Modify the main.php global profile to turn on the Urlmanager feature
/*
' Urlmanager ' =>array (
' Urlformat ' = ' path ',//whether to enable PathInfo mode URL address
' Rules ' =>array (//set pseudo static suffix
' <controller:\w+>/<id:\d+> ' = ' <controller>/view ',
' <controller:\w+>/<action:\w+>/<id:\d+> ' = ' <controller>/<action> ',
' <controller:\w+>/<action:\w+> ' = ' <controller>/<action> ',
),
),
*/
Remove comments
-------------------------------
Pseudo-Static
For example:
Original address: http://localhost/Project/app/index.php?r= Controller/method
New address: http://localhost/Project/app/index.php/Controller/method. html
' Urlmanager ' =>array (
' Urlformat ' = ' path ',//whether to enable PathInfo mode URL address
' Rules ' =>array (//set pseudo static suffix
' Controller alias/Method alias ' =>array ("Original controller name/original method name", "urlsuffix" = ". html"),//Add pseudo-static to the specified page
' <controller:\w+>/<action:\w+> ' =>array (' <controller>/<action> ', ' urlsuffix ' and ' = '). HTML "),//Add pseudo-static to all pages, such as with parameters, pseudo-static does not work
' Controller alias/method alias/< parameter name: Regular expression >/< parameter name: Regular expression > ' + ' original Controller name/original method name,//Set page pass parameters for the specified page
' Controller alias/method alias/< parameter name: Regular expression >/< parameter name: Regular expression > ' =>array (' original controller name/original method name ', ' urlsuffix ' = '. html '),//Set parameters for the specified page, and set pseudo-static, but only works on a single page
),
),
-------------------------------
Omit the entry file from the URL
The rewrite function must be used to achieve
URL address beautification in Yii