【发布时间】:2011-08-16 09:38:09
【问题描述】:
- http://www.a.com/content/1
-
http://www.a.com/content/seo-text-1
RewriteRule ^content/(\d+)|.+?-(\d+) action/index.php?id=$2
这条规则不起作用second url,如何解决?
谢谢
【问题讨论】:
标签: apache mod-rewrite
http://www.a.com/content/seo-text-1
RewriteRule ^content/(\d+)|.+?-(\d+) action/index.php?id=$2
这条规则不起作用second url,如何解决?
谢谢
【问题讨论】:
标签: apache mod-rewrite
如果出于任何原因您需要将它放在单个规则中,您可以使用这个:
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]
【讨论】: