我尝试使用 yii 框架制作网站,并制作友好的网址。如果我使用友好的网址,例如:
http://localhost/eshops/ -> calls protected/controllers/SiteController->actionIndex()
http://localhost/eshops/login -> calls protected/controllers/SiteController->actionLogin()
http://localhost/eshops/logout -> calls protected/controllers/SiteController->actionLogout()
...
但是如何使用另一个控制器 AbcController
http://localhost/eshops/abc/a -> calls protected/controllers/AbcController->actionA()
http://localhost/eshops/abc/b -> calls protected/controllers/AbcController->actionB()
它不显示“错误404”?
.htaccess 是
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
规则在 protected/config/main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'caseSensitive'=>false,
'rules'=>array(
'gii'=>'gii',
'<action>'=>'site/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
谢谢