0

I have an ARR redirect rule in my SharePoint 2019 site, to redirect from some external 404 links:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="Fix broken site links" stopProcessing="true">
                <match url="/_layouts/path/to/some404/(.*)" />
                <action type="Redirect" url="/" redirectType="Found" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

I have added this rule via the IIS manager to the site called SharePoint - www.redacted.url and can observe that the web.config in C:\inetpub\wwwroot\wss\VirtualDirectories\www.redacted.url443 contains my rule.

This rule isn't working and I see the 'Sorry, something went wrong' error. The URL with a 404 is to a _layouts page, but when I repeat the process with a non-layouts URL, the only difference is a slightly different error page.

Do I need to do something extra to get SharePoint to follow my ARR rule?

1 Answer 1

0

For some reason I don't fully understand, removing the _layouts from the match pattern caused the redirect to suddenly work. I also had to remove all spaces from the rule name. So, to redirect from /_layouts/someOldLayoutsPage.aspx to /_layouts/someNewLayoutsPage.aspx, the rule would look like:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="WorkingLayoutsPageRedirect" stopProcessing="true">
                <match url="/someOldLayoutsPage.aspx" />
                <action type="Redirect" url="/_layouts/someNewLayoutsPage.aspx" redirectType="Found" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

Note the visible inconsistency with /_layouts/ appearing on the outgoing url, but not on the incoming url. Go figure. Microsoft...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.