2012-10-30 51 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应用程序使用。客户不会看到任何改变。

相关问题