首先是 Apache 不是nginx
第一:
httpd.conf配置文件中加载了mod_rewrite.so模块
第二:
AllowOverride None 将None改为 All #这是tp5官方写的 我没改 也没问题#
第三:
*将 index.php 和 .htacess 文件移出到和Public 文件平级目录
第四:
修改.htacess 文件的内容为

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule>

备注:tp5.1 文档 写的 和我这不一样 我尝试官方写的 我没成功 因此用的就是上面我写的。
附:
tp5.1 文档地址 以及截图:

《thinkphp 5.1 文档地址》
截图
thinkphp5.1 隐藏url的index.php

相关文章: