【问题标题】:Apache Rewrite problemApache重写问题
【发布时间】:2011-08-16 09:38:09
【问题描述】:
  1. http://www.a.com/content/1
  2. http://www.a.com/content/seo-text-1

    RewriteRule ^content/(\d+)|.+?-(\d+) action/index.php?id=$2

这条规则不起作用second url,如何解决?

谢谢

【问题讨论】:

    标签: apache mod-rewrite


    【解决方案1】:

    如果出于任何原因您需要将它放在单个规则中,您可以使用这个:

    RewriteRule ^content/(.*)-?(\d+)$ action/index.php?id=$2 [R]
    

    但更具可读性的解决方案是使用两条规则:

    RewriteRule ^content/(\d+)$ action/index.php?id=$1 [R]
    RewriteRule ^content/.*-(\d+)$ action/index.php?id=$1 [R]
    

    【讨论】:

      猜你喜欢
      • 2011-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-03
      • 2012-04-23
      • 2014-09-26
      • 1970-01-01
      相关资源
      最近更新 更多