AccessMan
AccessMan

Reputation: 55

IIS 7 URL Rewrite and Web.config

I'm new to this, but did try researching it. I can't find a suitable answer.

I am trying to rewrite some pages with the same names, but different directories to a single new page. For Example:

/dir1/oldpage.aspx

/dir2/oldpage.aspx

/dir1/dir2/oldpage.aspx

rewrite all locations of oldpage.aspx to /new/newpage.aspx

I tried this below, but it did not work. Any suggestions would be greatly appreciated

<system.webServer>
<rewrite>
    <rules>
        <rule name="SpecificRedirect" stopProcessing="true">
            <match url="^page$" />
            <action type="Redirect" url="/page.html" />
        </rule>
    </rules>
</rewrite>
</system.webServer>

Upvotes: 0

Views: 72

Answers (1)

Oleg Alekseenko
Oleg Alekseenko

Reputation: 130

your match pattern means something like yourdomain.org/page

you should try

 <match url=".*oldpage\.aspx" />

"^" - means that pattern must start with "page".

"$" - means that after page there is no any character

Upvotes: 1

Related Questions