Let us say our previous website was a WordPress application with links like example.com/about-us that served up static pages.

Well now our application is an Angular 6 SPA being served in IIS through Azure. Right now to solve broken links on search results that have the old site cached we are using the default catch-all angular 404 technique.

    path: '404', component: Error404Component
    path: '**', redirectTo: '404'

I am worried that since all of these dead links on search results now return a status 200 instead of a status 404 that Google and Bing will think these are still valid links and never update them. Even worse is that the IIS web.config code to make angular routes work on refresh / direct navigation:

<rule name="Angular Routes" stopProcessing="true">
        <match url=".*"/>
        <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
        <action type="Rewrite" url="/"/>

also prevents 404 codes from being sent back in the http headers since it still served index.html/root and its the angular router that crashes.

Is this a valid concern?

  • Can you redirect all the old URLs to their new counterparts? – Stephen Ostermiller Jun 19 '18 at 15:04
  • Not all of them have counterparts. – Scott Clark Jun 19 '18 at 15:17
  • Usually rewrite maps can be used, to map important old links to new links, docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/…, and 301 redirection would force Google/Bing to update their indexed items to the new links. You only need this in the first few weeks and just a few rules on the most frequently visited pages. – Lex Li Sep 9 '18 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.