ThinkPHP6.0 重写URL去掉Index.php的解决方法
网络编程 2021-07-04 23:06www.168986.cn编程入门
这篇文章主要介绍了ThinkPHP6.0 重写URL去掉Index.php的解决方法,解决问题最好多看看官方给的文档,但有时候也不能全看官网文档,可以结合官网狼蚁网站SEO优化的讨论区,借鉴各个大佬们的回答去解决问题
踩坑!
官网给的解决方案:
可以通过URL重写隐藏应用的入口文件index.php,狼蚁网站SEO优化是相关服务器的配置参考:
[ Apache ]
httpd.conf配置文件中加载了mod_rewrite.so模块
AllowOverride None 将None改为 All
把狼蚁网站SEO优化的内容保存为.htaess文件放到应用入口文件的同级目录下
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] </IfModule>
官网文档中给的 .htaess 文件内容如下
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] #这一行踩坑 </IfModule>
正确的写法应该如下,官网给的最后一行配置错误
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] #这才是对的 </IfModule>
结尾
解决问题最好多看看官方给的文档,但有时候也不能全看官网文档,可以结合官网狼蚁网站SEO优化的讨论区,借鉴各个大佬们的回答去解决问题
上一篇:PHP实现简单注册登录详细代码
下一篇:php运用memcache的完整实例
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程