404 redirects not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BobLaughland

    #1

    404 redirects not working

    Hi All,

    I am trying to get my website to redirect all 404 errors to the
    sitemap page, but I am having trouble.

    The first thing I am doing is this,

    <customErrors mode="On" defaultRedirect ="~/en/Sitemap1/?id=72">
    <error statusCode="404 " redirect="~/en/Sitemap1/?id=72" />
    </customErrors>

    This works if I get the URL wrong and include an aspx extension, e.g.



    But does not work if I do this,



    I have tried changing the custom errors in IIS, but I am not exactly
    sure what to add in there, I put /en/Sitemap1/?id=72 and that doesn't
    work.

    Not sure exactly how to explain this, but I am building on a CMS
    system called EPiServer, so the URLs that I provide are translated
    into a specific instance of a page template, so I cannot just put the
    absolute path of the URL (hence the reason for the id=72 above).

    Please help.
  • George Ter-Saakov

    #2
    Re: 404 redirects not working

    only what goes through .ASP.NET would be subject to .NET "rules"....
    since http://mysite/gardbage does not have .NET extension it will not be
    processed by .NET.
    You need to modify your IIS default settings for 404 error.

    PS: I heard in IIS 7.0 you can send all requests through .NET even those
    without extension.

    George.


    "BobLaughla nd" <peter.mcclymon t@gmail.comwrot e in message
    news:47b603fb-9c6a-44d1-a7c8-78fb55cc14ef@e6 g2000prf.google groups.com...
    Hi All,
    >
    I am trying to get my website to redirect all 404 errors to the
    sitemap page, but I am having trouble.
    >
    The first thing I am doing is this,
    >
    <customErrors mode="On" defaultRedirect ="~/en/Sitemap1/?id=72">
    <error statusCode="404 " redirect="~/en/Sitemap1/?id=72" />
    </customErrors>
    >
    This works if I get the URL wrong and include an aspx extension, e.g.
    >

    >
    But does not work if I do this,
    >

    >
    I have tried changing the custom errors in IIS, but I am not exactly
    sure what to add in there, I put /en/Sitemap1/?id=72 and that doesn't
    work.
    >
    Not sure exactly how to explain this, but I am building on a CMS
    system called EPiServer, so the URLs that I provide are translated
    into a specific instance of a page template, so I cannot just put the
    absolute path of the URL (hence the reason for the id=72 above).
    >
    Please help.

    Comment

    • BobLaughland

      #3
      Re: 404 redirects not working

      Right, that makes sense.

      That would suggest that my URL /en/Sitemap1/?id=72 that I added into
      the IIS settings is incorrect.

      The problem is that I get a 404, but that could be one of 2 things,
      the original page 404 (e.g. http://mysite/garbagepage) or the
      redirection to the sitemap page because it cannot find it.

      I am using EPiServer (a web CMS system) so it does some fancy things
      with the URLs, they don't map directly to the folders on the server
      because the pages are instances of template pages.

      Comment

      Working...