location / {
# 新增301重定向规则
rewrite ^/read-([^?]+)\.html$ /read-$1.html permanent;
# 保留原有伪静态规则
if (!-e $request_filename) {
rewrite ^((.*)/)?(.*)$ $1/index.php last;
}
}
1.html?xxx 不跳转1.html
location / {
# 新增301重定向规则
rewrite ^/read-([^?]+)\.html$ /read-$1.html permanent;
# 保留原有伪静态规则
if (!-e $request_filename) {
rewrite ^((.*)/)?(.*)$ $1/index.php last;
}
}
1.html?xxx 不跳转1.html
location / {
# 修正301重定向:丢弃查询参数,实现 1.html?xxx → 1.html
rewrite ^/read-([^/]+)\.html$ /read-$1.html? permanent;
# 保留原有伪静态规则(顺序不变,重定向优先)
if (!-e $request_filename) {
rewrite ^((.*)/)?(.*)$ $1/index.php last;
}
}