2012-10-30 50 views
0

所以我應該能夠訪問rsstest/test.xml並將其轉發到article.xml,如果我沒有用戶代理的wibble。誰能告訴我這個IIS URL重寫有什麼問題嗎?

爲什麼不能正常工作?

<rule name="df" patternSyntax="ExactMatch" stopProcessing="true"> <match url="^rsstest/test.xml" negate="true" /> <conditions> <add input="{HTTP_USER_AGENT}" pattern="Wibble" negate="true" /> </conditions> <action type="Rewrite" url="article.xml" /> </rule>

在此先感謝

+0

我相信它與URL中的'^'有關,而且您正在使用'ExactMatch'。 – Ren

+0

感謝您的回覆。我試圖拿出這個無濟於事。 – user1242345

+0

當你說你想要被轉發時,你的意思是重定向而不是重寫? – Ren

回答

0

嘗試改變規則了這一點。

<rule name="df" patternSyntax="ExactMatch" stopProcessing="true"> 
    <match url="^rsstest/test.xml" negate="true" /> 
    <conditions> 
     <add input="{HTTP_USER_AGENT}" pattern="Wibble" negate="true" /> 
    </conditions> 
    <action type="Redirect" url="article.xml" /> 
</rule> 

使用重定向將HTTP 301或302發送到客戶端,告訴客戶端它應該嘗試使用另一個URL訪問該頁面。

重寫發生在服務器上,簡單地說就是將一個URL轉換爲另一個URL,這個URL會被Web應用程序使用。客戶不會看到任何改變。

相關問題