我的 yii 应用程序安装在虚拟主机 ( http://yii.loc ) (WAMP) 中。我需要从 url 中删除 index.php。但只有http://yii.loc网址有效,其他页面显示“未找到”。
'urlManager'=>array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '/',
'<controller:\w+>/ <action:\w+>' => '/',
),
.htaccess
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php