嘿guyz我是Yii框架中的新手.我想从我的网址中删除index.php.在yii文档之后,当我将重写引擎代码放入我的.htaccess文件并在我的config/main.php文件中将showScriptName设置为false时,我得到500内部服务器错误.我的.htaccess文件位于我的应用程序的根文件夹中.告诉我我在哪里做错了
更新:
这是我的.htaccess文件中的代码:
# 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
Run Code Online (Sandbox Code Playgroud)
Akh*_*yil 15
试试这个
这里有一个很好的描述
http://www.yiiframework.com/doc/guide/1.1/en/topics.url#hiding-x-23x
如果您还想/index从主页面URL中删除,请添加''=>'site/index'到urlManager规则的顶部,如下所示:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
'rules'=>array(
''=>'site/index',
'<action>'=>'site/<action>',
Run Code Online (Sandbox Code Playgroud)