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