简体   繁体   中英

can anyone tell me whats wrong with this IIS URL rewrite?

So i should be able to visit rsstest/test.xml and be forwarded to article.xml if i don't have a user agent of wibble.

why doesn't this work?

<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>

thanks in advance

Try changing the rule to this.

<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>

Using redirect sends a HTTP 301 or 302 to the client, telling the client that it should try to access the page using another URL.

Rewriting happens on the server, and simply is a translation of one URL to another, that is used by your web application. The client will not see any change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM