Take the 2-minute tour ×

I'm just starting to work with URL Rewrite 2.0 in c#.net web.config. My web.config looks like this:

    <rule name="RemoveTrailingSlashRule2" stopProcessing="true">
      <match url="(.*)/$" />
    <action type="Redirect" url="{R:1}" />

This should remove the trailing slash on a URL. When I run the app, the rule appears to work at the root level, so this...


...gets redirected to...


...but the redirect doesn't work at other levels.

So the problem is that this...


...ends up with the trailing slash staying in place and if I try this...


...the trailing slash is actually APPENDED.

My guess is that this is the 'courtesy trailing slash' that IIS 7 adds, but I don't know how to get the URL Rewrite rule to override it?

share|improve this question
add comment

1 Answer

I know that this is a year old, but I was having the same issue so I decided to post the solution.

The problem is:


should be

<match url="(.*)\/$" />

Once that is changed everything works.

share|improve this answer
That doesn't seem to make any difference. –  Hainesy Sep 24 '13 at 8:22
add comment

Your Answer


