skip to Main Content

I wonder if anyone could shed any light on something that I don’t think is possible…..

A site is being decommissioned and the site owners have supplied an enormous list of URL redirects (5000) to be enforced. The vast majority of the entries on this list all redirect to a generic landing page.

So, the question is is there a way to use the HTTP redirect functionality in the web config to handle specific redirects (oldsite.com/page1 to newsite.com/page1, oldsite.com/page2 to newsite.com/page2, etc etc) and have anything that’s not in the list of specific redirects be directed to the generic landing page?

Thanks,
C

2

Answers


  1. Yes, I’d think so. The IIS Rewrite module lets you define any number of redirect rules and I believe they will be executed "in turn". So you should be able to create rule(s) for the specific URLs (oldsite/page1 -> mewsite/page1 etc) and then have a catch-all after those. https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module#creating-a-redirect-rule

    Login or Signup to reply.
  2. Yes, you can use the rewrite module in IIS to handle specific redirects and route content outside the specific redirect list to the generic login page.

    The following is an example of how to set up redirect rules in web.config:

        <rewrite>
            <rules>
                <!-- Specific redirects -->
                <rule name="Redirect page1">
                    <match url="^page1$" />
                    <action type="Redirect" url="https://newsite.com/page1" />
                </rule>
                <rule name="Redirect page2">
                    <match url="^page2$" />
                    <action type="Redirect" url="https://newsite.com/page2" />
                </rule>
                <!-- Add more specific redirects as needed -->
    
                <!-- Catch-all redirect -->
                <!-- Any other URL will be redirected to the generic login page -->
                <rule name="Redirect to Generic Landing Page">
                    <match url=".*" />
                    <action type="Redirect" url="https://newsite.com/generic-landing-page" />
                </rule>
            </rules>
        </rewrite>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search