IIS Rewrite rule seems happens twice
NickName:Andrew Lindemulder Ask DateTime:2016-08-26T21:32:03

IIS Rewrite rule seems happens twice

I have a simple rewrite rule as follows:

<rule name="short url" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_URI}" pattern="redirect(.*)" negate="true" />
        <add input="{REQUEST_URI}" pattern="pages(.*)" negate="true" />
    </conditions>
    <action type="Redirect" url="/redirect?page={R:1}" appendQueryString="true" logRewrittenUrl="true" />
</rule>

However, if a put a breakpoint in our code on the redirect target page it gets hit twice.

Why would this happen?

Copyright Notice:Content Author:「Andrew Lindemulder」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/39167588/iis-rewrite-rule-seems-happens-twice

More about “IIS Rewrite rule seems happens twice” related questions

IIS Rewrite rule seems happens twice

I have a simple rewrite rule as follows: &lt;rule name="short url" enabled="true" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping=&quo

Show Detail

How to create a EXCEPT Rewrite Rule at IIS

I have an IIS Site with Rewrite Rule to redirect all requests to HTTPS. I have a internal web service which works with HTTP but rewrite rule modify &quot;http&quot; request to a &quot;https&quot;. ...

Show Detail

Converting IIS rewrite rule to Apache

So I'm having trouble converting this rewrite rule in IIS to Apache. Works well in IIS but not at all in apache. Original IIS rewrite rule: &lt;rule enabled="true" stopProcessing="true" name=&q

Show Detail

IIS rewrite rule within subfolder

I have 2 separate sites. One site is within a subfolder of the main site. I need to force HTTPS to both sites but keeping the query string intact as users can enter the site from internal pages. The

Show Detail

IIS URL Rewrite Rule Cached

I've configured some URL rewrite rules in IIS which seems to be working fine. I did make a mistake in the one rule during initial setup, picked it up while testing in browser and fixed the rule. Th...

Show Detail

mod rewrite to IIS rewrite rule

I have a rule in my .htaccess which is RewriteRule ^([a-zA-Z0-9-_]+)$ listing-search.php?profile=$1 [QSA,L] RewriteCond %{REQUEST_FILENAME}\.php -f It basically looks for profile names after the ...

Show Detail

IIS Rewrite - Redirect Rule and Add Response Header together

In IIS, I have a set of redirect rules using IIS Rewrite module. In that, I would like to redirect an URL as well as add custom header to the response. I have setup redirect rule and an outbound ru...

Show Detail

mod rewrite to IIS rewrite rule issue

Hi im getting these errors when im trying to to convert this file in IIS mod_rewrite This directive was not converted because it is not supported by IIS: RewriteBase /php-login/ And The

Show Detail

IIS URL Rewrite - IIS 7

I am new to using IIS Url Rewrite. I installed it and set up a rule using IIS, but nothing happens when I try to access a url in my localhost. Below is what IIS put in my web.config. When I access ...

Show Detail

IIS Rewrite rule with QueryString in Rewrite

I'm having a problem with an IIS rewrite rule. We have many set up and working in our web.config file. I am trying to modify one of them. Apologies for the level of this question. I'm not experienc...

Show Detail