【问题标题】:nginx rewrite rule for two php parameters两个php参数的nginx重写规则
【发布时间】:2015-08-09 21:04:09
【问题描述】:

你能帮我写一下 ngnix 的重写规则吗:

    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?$1/$2;

   rewrite ^/(.*)/(.*)$ /all-dog-breeds.php?$1/$2 last; 

【问题讨论】:

标签: regex linux apache nginx system-administration


【解决方案1】:

您实际要查找的正则表达式是:https://regex101.com/r/uC1wH6/3

我认为应该转换成Apache如下:

rewrite ^\/[^\/]*\?(.*)$ /$1

【讨论】:

  • 如果一切顺利,请单击此答案左侧的复选标记接受。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-06
  • 2016-06-20
  • 2010-11-20
相关资源
最近更新 更多