0

我有以下重写规则

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$   articles.php?t=$1&p=$2    [NC,L]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([0-9-]+)/?$   articles.php?t=$1&p=$2&id=$3    [NC,L]

我的问题是pcommunity是否希望它重定向到 community.php 并保留查询字符串。

所以网址会变成community.php?t=$1&p=$2&id=$3community.php?t=$1&p=$2

谢谢

4

1 回答 1

0

在现有规则之前,您可以有 2 条这样的附加规则:

RewriteCond %{REQUEST_URI} ^/[a-z0-9-]+/community/ [NC]
RewriteRule ^([a-z0-9-]+)/([a-z0-9-]+)/?$ community.php?t=$1&p=$2 [L,QSA,NC]

RewriteCond %{REQUEST_URI} ^/[a-z0-9-]+/community/ [NC]
RewriteRule ^([a-z0-9-]+)/([a-z0-9-]+)/([0-9-]+)/?$ community.php?t=$1&p=$2&id=$3 [L,QSA,NC]
于 2013-10-14T06:40:52.790 回答