Learning that yii today, the URL is too troublesome, want to configure themselves, so Baidu a bit, and then their own summary, save the back of the configuration of the time to see.
There is an important component in the YII framework: URL Management (URL management)
Yii pseudo-Static is only necessary to configure this can be.
Not configured before this is the way:
The URL after a successful configuration is this:
First step: Configure URL Management (URL management)
Just configure it in the main.php file below the Config folder.
' Components ' = = Array ( ' urlmanager ' = ' = ' showscriptname ' = ' false,//here is the hidden index.php that path ' Urlformat ' + ' path ', ' rules ' and ' = ' <controller:\w+>/<id:\d+> ' + ' <controller>/ View ', ' <controller:\w+>/<action:\w+>/<id:\d+> ' = ' <controller>/<action> ', ' <controller:\w+>/<action:\w+> ' = ' <controller>/<action> ' ] , ' User ' = = Array ( //Enable cookie-based authentication ' allowautologin ' = True ), <span style= " Font-family:arial, Helvetica, Sans-serif; >) </span>
Step two: Perform Apache configuration
There is a file in Yii:. htaccess is used to configure the Apache server specifically, this file is configured to enter the following code
<ifmodule mod_rewrite.c>options +followsymlinksindexignore */*rewriteengine on# If a directory or a file exists, use It directlyrewritecond%{request_filename}!-frewritecond%{request_filename}!-d# otherwise forward it to INDEX.PHPREWR Iterule. Index.php</ifmodule>
Once this file has been configured, be sure to turn on the rewrite module in Apache:
And then it's OK.
The configuration of the entire URL is complete.
Yii 1.0 pseudo Static or yii configuration URL rewrite