如果你使用宝塔面板,请直接在宝塔面板后台
->网站->伪静态 中选择ThinkPHP5的伪静态规则即可。
如果你使用的是 lnmp.org 的一键安装LNMP环境,请查阅 https://lnmp.org/faq/lnmp-vhost-add-howto.html#rewrite 的伪静态配置。
如果你使用的是 phpStudy ,建议参考视频安装教程中的伪静态配置:https://www.fastadmin.net/video/install.html。
Apache规则
<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>
Nginx规则
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}