昨天俺老刘刚发了一个thinphp6开发过程中apache未设置默认首页导致一直500错误,今天又遇上了一个
话说我以前一直是在Nginx下开发的,而且在开发的时候我都不用伪静态,直到部署到服务器才伪静态
这几天在研究个源码,里面很多路径都没用url函数,懒得修改,直接配置了伪静态
没想到不断地踩坑
thinkphp6提供的apache伪静态规则是 .htaccess
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
这个规则在部分apache上没有问题,但在有些服务器上却出错,哪些版本我没细研究,反正上面的出错,换下面的就可以
把最后一句换成
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
另外提供我昨天的规则,加了默认首页 .htaccess
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>
本文完,本人喜欢php和python语言,欢迎加我微信jsjlaoliu共同交流。