0

Looking to redirect a page with 2 parameters what i have is

RewriteEngine On

RewriteCond %{QUERY_STRING} ^([^&]&)*id=8(&|$)

RewriteCond %{QUERY_STRING} ^([^&]&)*date=1349996400(&|$)

RewriteRule ^/calendar/event\.php$ /news/nrsc-chloramines-open-house/ [R=301,L]
4

1 回答 1

0

您需要去掉正则表达式中的前导斜杠。通过 htaccess 文件中的重写规则发送的 URI 已去除前导斜杠。此外,您可以使查询字符串的开始边界匹配更好一点:

#                             v--- make it match beginning or &
RewriteCond %{QUERY_STRING} (^|&)id=8(&|$)
RewriteCond %{QUERY_STRING} (^|&)date=1349996400(&|$)
#             v---- make optional
RewriteRule ^/?calendar/event\.php$ /news/nrsc-chloramines-open-house/ [R=301,L]
于 2012-09-24T23:53:43.433 回答