Yii framwork - Url Manager
Url Manager
A. User-friendly URLS
array(
......'components'=>array(
......'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=> false,
'urlFormat'=> false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view ',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
),
);
B. Set .htaccess
RewriteEngine on# if a directory or a file exists, use it directlyRewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d# otherwise forward it to index.php
RewriteRule . index.php
浙公网安备 33010602011771号