404 redirects not working

B

BobLaughland

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.

http://mysite/garbagepage.aspx

But does not work if I do this,

http://mysite/garbagepage

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

George Ter-Saakov

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

BobLaughland

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top