美文网首页
TP6开启重写模式,隐藏index.php

TP6开启重写模式,隐藏index.php

作者: IronMan999 | 来源:发表于2019-06-04 15:38 被阅读0次

阿里云服务器3折开售(点此直达)

image
  1. 按照官方教程 \color{red}{URL重写} 部分,先配置 URL重写

  2. AllowOverride None 这个选项,在 PHPStudy的


    微信图片_20190604145252.png
  1. 需要修改的 .htaccess 文件,
    \color{red}{是在 public 下的!!!} 不是 app 目录下的 .htaccess 重要的事情说三遍,

    • 修改的是 public 下的 .htaccess 文件!
    • 修改的是 public 下的 .htaccess 文件!
    • 修改的是 public 下的 .htaccess 文件!
  2. 教程提供的 重写规则有问题。最后一行代码,需要用下面的

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>

因为,修改错了文件,耗费了一个多小时的时间,各种查找,自己猛然醒悟,修!改!错!了!文件!!!脑子突然开窍了……

相关文章

网友评论

      本文标题:TP6开启重写模式,隐藏index.php

      本文链接:https://www.haomeiwen.com/subject/detrxctx.html