All project content is available for reading, but you need to be a member of the project for Subversion checkout of source code, or to create/modify any information.
Login if you are a member. Apply here to request membership (open to all).

Ticket #198 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

The module returns status code 302

Reported by: rannveig.aarnes@… Owned by: steve@…
Priority: major Component: 404Handler
Keywords: wrong status code Cc:



When I use Fiddler I can see that the module returns 302, when it should be 404.
When we redirect from old URL to new URL, I need to use 301 redirect, so that searchengines understand that the old pages don't exist.

Change History

comment:1 Changed 12 years ago by steve@…

  • Status changed from new to closed
  • Resolution set to fixed

It depends. On IIS 7.x, if you ask for www.mysite.com/nonexistingpage it will give you a 404 directly, but if you ask for www.mysite.com/nonexistingpage.aspx, it will actually redirect first (using 302) to the "not found" page, which will return 404.

So, I guess both 301 and 302 are wrong in this case, and the problem seems to be hard to solve.

Example trace when asking for /nonexistingpage:

404	www.mysite.no	/nonexistingpage

Example trace when asking for /nonexistingpage.aspx:

302	www.mysite.no	/nonexistingpage.aspx
404	www.mysite.no	/404notfound.aspx?aspxerrorpath=%2fnonexistingpage.aspx

When redirecting to a new url (from the customredirects.xml file) it should be using a 301 status, and I have fixed a bug in the code so it will now return 301 instead of 302 (see changeset:1502)

The .aspx problem above is present also for redirects. See the following example:


Correct redirect when url does not contain .aspx:

301 www.mysite.no /templates/article____41134
200 www.mysite.no /About-us/organisation/

With .aspx extension, an intermediate redirect is needed.

302 www.mysite.no /templates/article____41134.aspx
301 www.mysite.no /404notfound.aspx?aspxerrorpath=%2ftemplates%2farticle____41134.aspx
200 www.mysite.no /About-us/organisation/

I wonder what search engines think of this. In any way, it is better than the previous case (returning 302).

Note: See HelpUser/Tickets for help on using tickets.