这是我需要删除最后一段的 URL(?order=asc)
https://www.example.com/segment_1/segment_2/page/the_number_goes_here/?order?asc
这是我正在尝试的代码:
location ~ ^/([^/]+)/([^/]+)/page/(\d+)/ {
try_files $uri $uri/ /index.php?$args;
# Capture the 2 segments and page number
set $segment_1 $1;
set $segment_2 $2;
set $page_number $4;
# Redirect without the sufix
rewrite ^ /$segment_1/$segment_2/page/$page_number/ permanent;
}