2012-09-24 41 views
0

尋找到一個頁面重定向有兩個參數我有什麼重定向是htaccess的與參數

RewriteEngine On 

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

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

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

回答

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]