【问题标题】:NGINX pretty url rewrite - get value of parameter and rewrite to value pageNGINX 漂亮的 url 重写 - 获取参数的值并重写到值页面
【发布时间】:2018-08-01 21:49:49
【问题描述】:

我想将 domain.tld/index.php?a=value 重写为 domain.tld/value

例如

domain.tld/index.php?a=contact to domain.tld/contact

domain.tld/index.php?a=latest 到 domain.tld/latest

等等……

有什么办法吗?

Apache 规则如下:

RewriteRule ^(.*) $1 [L]

RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$  index.php?a=$1&q=$3    [L]

【问题讨论】:

    标签: redirect nginx indexing parameters url-rewriting


    【解决方案1】:

    解决了

    rewrite ^/(\w+)$ /index.php?a=$1 last;
    rewrite ^/(\w+)+\/$ /index.php?a=$1&q=$3 last;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-06
      • 2016-01-25
      • 1970-01-01
      • 2012-01-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多