如何使用Yii2从URL中删除index.php文件?
当我在Yii中设置选项以从URL中删除index.php时,我收到404错误并在错误日志中出现此错误File does not exist: /var/live/var
.在我的浏览器中,我收到此错误,The requested URL /var/decat/frontend/web/index.php was not found on this server.
但文件正好在该位置.可以解释的是,我的文档根目录是/var/live
和decat是别名,如conf文件中所示.
这个网址工作正常http://130.211.165.180/decat/index.php/site/login但是当我删除index.php时,我收到错误.我按照所有说明在conf文件中进行设置.我甚至尝试过.htaccess文件.这是我的conf文件中的信息.
Alias /decat /var/decat/frontend/web# use mod_rewrite for pretty URL support RewriteEngine on # If a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise forward the request to index.php RewriteRule . index.php Options -Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all
Viacheslav.. 7
添加RewriteBase /decat/
后RewriteEngine on
重启apache.
1> Viacheslav..:
添加RewriteBase /decat/
后RewriteEngine on
重启apache.
PHP之友评论