【php】 nginx配置重写域名,去除index.php的写法
在对应的vhost文件里面加上这一段
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
如图:

这一段写入nginx.htaccess也可以,因为include了这个文件了, 如果入口文件不是index.php,将rewrite ^/index.php(.*)$ /index.php?s=$1 last;中index.php改成对应的文件名称即可

浙公网安备 33010602011771号