2012-04-12 237 views
0

使用URL重寫模塊,我有被定義的規則設置爲:IIS URL重寫

Matches the pattern 
Regular Expressions 
Pattern: /support/viewmessages.aspx 
Ignore Case: true 
Action Type: Redirect 

Redirect URL: http://newdomain/support/viewmessages.aspx 
Append Query String: true 
Redirect Type: 301 

這聽起來好像它應該重定向任何URL的格式化,如:
http://olddomain/support/viewmessages.aspx?forum=20&topic=75942&ForumName=General%20Discussion
成爲:
http://newdomain/support/viewmessages.aspx?forum=20&topic=75942&ForumName=General%20Discussion

但是,似乎沒有任何事情發生。我在舊域上獲得了我的404,並且它不會追加到查詢字符串的404上。

下面是IIS在我的web.config生成的代碼:

<rule name="Forum Posts" patternSyntax="ECMAScript" stopProcessing="true"> 
    <match url="/support/viewmessages.aspx" /> 
    <action type="Redirect" url="http://newdomain/support/viewmessages.aspx" appendQueryString="true" /> 
</rule> 

任何幫助,將不勝感激。

+0

聽起來好像這是沿着serverfault問題的線條更。 「編程」在哪裏? – 2012-04-12 19:26:47

回答

1

嘗試1:你有沒有嘗試沒有正斜槓的模式?另一個想法是,是否有特殊的斜線和圓點,因爲它們可能被視爲正則表達式中的特殊字符。


第2點:你確實認識到這個點是regular expressions,中的特殊字符吧?您可能必須找到一種方式來逃避它,這樣的URL喜歡就好「/support/viewmatches\.aspx」

+0

剛剛嘗試過,沒有領先的正斜槓,沒有骰子。 – 2012-04-12 19:26:21

+0

「/support/viewmatches\.aspx」無法正常工作,但是「support/viewmatches \ .aspx」 - 因此看起來您在兩條戰線都是正確的! – 2012-04-12 19:39:23