以PHPStudy为例,在Nginx的配置文件中,打开conf/vhosts/网站.conf

原来的格式如下:

1
2
3
4
5
location / {
index index.php index.html;
include C:/wwwroot/writerfly/web/public/nginx.htaccess;
autoindex off;
}

修改为:

1
2
3
4
5
6
7
8
9
location / {
index index.php index.html;
if (!-e $request_filename) { #添加当前与以下模块
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
include C:/wwwroot/writerfly/web/public/nginx.htaccess;
autoindex off;
}