两个 php 参数的 nginx 重写规则
nginx rewrite rule for two php parameters
你能帮我写一个nginx的重写规则吗:
Actual URL : http://www.example.com/all-dog-breeds.php?Greater-Swiss-Mountain-Dog/82
expected URL : http://www.example.com/Greater-Swiss-Mountain-Dog/82
我尝试在下面重写 URL 但它不起作用:
rewrite ^/([A-Za-z-]+)\/([0-9]+)\/?$ /all-dog-breeds.php?/;
rewrite ^/(.*)/(.*)$ /all-dog-breeds.php?/ last;
您实际要查找的正则表达式是:https://regex101.com/r/uC1wH6/3
我认为应该如下转换成Apache:
rewrite ^\/[^\/]*\?(.*)$ /
你能帮我写一个nginx的重写规则吗:
Actual URL : http://www.example.com/all-dog-breeds.php?Greater-Swiss-Mountain-Dog/82
expected URL : http://www.example.com/Greater-Swiss-Mountain-Dog/82
我尝试在下面重写 URL 但它不起作用:
rewrite ^/([A-Za-z-]+)\/([0-9]+)\/?$ /all-dog-breeds.php?/;
rewrite ^/(.*)/(.*)$ /all-dog-breeds.php?/ last;
您实际要查找的正则表达式是:https://regex101.com/r/uC1wH6/3
我认为应该如下转换成Apache:
rewrite ^\/[^\/]*\?(.*)$ /