Slinky
Slinky

Reputation: 5832

Wildcard Redirection in IIS via web.config

The marketing people decided that they want us to change the URL of a page.

So anything like:

http://www.boyscouts.org/NewClubOpening/
http://www.boyscouts.org/NewClubOpening?c=16
http://www.boyscouts.org/NewClubOpening?c=16&s=invite
[...]

Should Redirect to

http://www.boyscouts.org/ClubOpening/
http://www.boyscouts.org/ClubOpening?c=16
http://www.boyscouts.org/ClubOpening?c=16&s=invite
[...]

I have done this in Apache before but never IIS. Hopefully there is a way to do this with a wildcard

From what I gathered something like:

  <rewrite>
    <rules>
        <rule name="newclubopening" stopProcessing="true">
            <match url="^NewClubOpening(.+)?" />
            <action type="Redirect" url="http://www.boyscouts.org/ClubOpening{R:1}" redirectType="Found" />
        </rule>
    </rules>
</rewrite>

Is that correct? How do you guys do this?

Thanks

Upvotes: 1

Views: 2858

Answers (1)

Slinky
Slinky

Reputation: 5832

I tested my directive with the IIS Redirect Tool Tester and I was correct, except for the caret at the beginning of the expression, which I removed.

http://www.iis.net/learn/extensions/url-rewrite-module/testing-rewrite-rule-patterns

Upvotes: 1

Related Questions