加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

Yii2从url中删除index.php

发布时间:2020-12-13 18:05:53 所属栏目:PHP教程 来源:网络整理
导读:当我在Yii中设置选项以从URL中删除index.php时,我收到404错误,并且错误日志中的此错误文件不存在:/ var / live / var.在我的浏览器中,我收到此错误在此服务器上找不到请求的URL /var/decat/frontend/web/index.php.但该文件正好在该位置.可以解释的是,我的
当我在Yii中设置选项以从URL中删除index.php时,我收到404错误,并且错误日志中的此错误文件不存在:/ var / live / var.在我的浏览器中,我收到此错误在此服务器上找不到请求的URL /var/decat/frontend/web/index.php.但该文件正好在该位置.可以解释的是,我的文档根目录是/ 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

<Directory "/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 
</Directory>
在RewriteEngine之后添加RewriteBase / decat /并重新启动apache.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读