ThinkPHP6.0 重写URL去掉Index.php的方法
免费源码 2025-05-15 03:55www.dzhlxh.cn免费源码
==============================
一、官方解决方案简述
二、结合狼蚁网站SEO优化的讨论区
```html
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.)$ index.php?/$1 [QSA,PT,L] 这里有一个常见的错误点,需要注意修正
```
其中,你需要特别注意官方文档中最后一行的配置可能存在错误。正确的写法应该是:
```html
Options +FollowSymlinks -Multiviews
RewriteCond %{REQUEST_FILENAME} !-d 排除目录请求
RewriteCond %{REQUEST_FILENAME} !-f 排除文件请求
RewriteRule ^(.)$ index.php [L,E=PATH_INFO:$1] 正确的写法,将请求转发到index.php处理,并传递路径信息给PHP脚本处理
```
三、总结与建议
-