Apache
项目文件根目录(ThinkPHP下的public)创建文件 .htaccess,在其中添加以下代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
Nginx
项目文件根目录(ThinkPHP下的public)创建文件 nginx.htaccess,在其中添加以下代码:
# 伪静态配置
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}