2012-07-12 25 views
0

我將網站上的舊網址重定向到其他網站上的新網址。它使用了宙斯網絡服務器,前兩條規則工作得很好。然而,它似乎並沒有與其中有查詢字符串的第三個網址...任何想法如何解決這個問題?看起來好像我可能需要一個正則表達式來處理特殊字符?,因爲如果我把它從比賽中取出,它可以正常工作。謝謝使用正則表達式查詢字符串重定向網址

match URL into $ with ^/$ 
if matched 
set OUT:Location = http://www.website.co.uk/ 
set OUT:Content-Type = text/html 
set RESPONSE = 301 
set BODY = Moved 
goto END 
endif 

match URL into $ with ^/index.php$ 
if matched 
set OUT:Location = http://www.website.co.uk/ 
set OUT:Content-Type = text/html 
set RESPONSE = 301 
set BODY = Moved 
goto END 
endif 

match URL into $ with ^/index.php?cPath=1_50$ 
if matched 
set OUT:Location = http://www.website.co.uk/categories.php?category=Boilers 
set OUT:Content-Type = text/html 
set RESPONSE = 301 
set BODY = Moved 
goto END 
endif 

回答

0

我不熟悉宙斯URL重寫。但是如果它使用標準的正則表達式,則需要用反斜槓來跳出?

match URL into $ with ^/index.php\?cPath=1_50$ 

問號通常是一個元字符,它修改前面的字符或表達式,使其成爲可選項。所以你的模式現在將匹配/index.phpcPath=1_50/index.phcPath=1_50

+0

是的,這是固定的。非常感謝。 – Cameron 2012-07-12 19:59:18

相關問題