0

我正在将数据从一个内容管理系统迁移到另一个。旧 URL 和新 URL 之间没有关系,尽管两者都包含查询字符串。我正在尝试设置一组重写,它将广泛的数据类别列表从一个重定向到另一个。

这是一个示例:

旧 rss.php?categoryID=53

新 index.php?module=news&type=user&func=list&tid=1&filter=blogtopic:eq:19

我试过了

RewriteRule ^rss.php\?categoryID=53 index.php?module=news&type=user&func=list&tid=1&filter=blogtopic:eq:19 [L]

但它不匹配。如果我跟着那个

RewriteRule ^rss.php index.php?module=news&type=user&func=list&tid=1 [L]

如果确实匹配,那么我得出结论,旧 URL 中的问号导致了问题。我已经在逃避问号了。我该怎么办?

我最终可能会在我的 .htaccess 文件中得到大约 50 个。

4

1 回答 1

0

您无法匹配 a 中的查询字符串(?之后的所有内容)RewriteRule,您需要使用 aRewriteCond并匹配 `%{QUERY_STRING} var:

RewriteCond %{QUERY_STRING} ^categoryID=53$
RewriteRule ^rss\.php$ /index.php?module=news&type=user&func=list&tid=1&filter=blogtopic:eq:19 [L]

[R=301,L]或者如果要重定向浏览器,请将括号更改为。

于 2012-07-27T17:35:49.450 回答