在本地phpstudy环境,根据官方文档https://www.kancloud.cn/manual/thinkphp5/177576进行URL重写,隐藏index.php不好用,百度方案,发现将.htaccess文件进行如下修改。
官方文件:
<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?s=$1 [QSA,PT,L] </IfModule>
解决问题RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]