2013-05-04 43 views
1

我正在使用ISAPI重寫來重新寫入我們網站的新聞。我遇到的問題是重寫規則沒有考慮可能爲谷歌跟蹤傳遞的可選參數。ISAPI重寫規則以允許可選參數

一個典型的鏈接是如下:

http://www.phmotorcycles.co.uk/motorcycle_news/categories/motorcycle-parts/news_801580922_rossi-jerez-is-%EF%BF%BDvery-important%EF%BF%BD.html

重寫規則覆蓋這就是:

Rewriterule ^/motorcycle_news/categories/(.*?)/news_(\d+)_(.*)\.html$ /newsItem.asp?cat=$1&cpID=$2&page=$3 [NC]

顯然問題出在使用後的$的。 html重寫規則的一部分。問題是我該如何改變它,以便可以將谷歌參數的組合添加到URL而不會導致服務器上的鏈接斷開?

參數喜歡:

?utm_source=dlvr.it&utm_medium=twitter 

任何線索大大歡迎和讚賞。

回答

0

請嘗試修復您的規則如下:

RewriteCond %{QUERY_STRING} ^(utm_source=.*&utm_medium=.*)?$ [NC] 
Rewriterule ^/motorcycle_news/categories/([^/]+)/news_(\d+)_(.*)\.html$ /newsItem.asp?cat=$1&cpID=$2&page=$3 [NC] 
+0

嗨@TonyCool爲您的代碼非常感謝,我已經把這個到位,它仍然是行不通的!你有任何進一步的想法來解決這個問題。非常感謝您的幫助! – EvilKermitSaurus 2013-05-07 07:29:32