homepage Welcome to WebmasterWorld Guest from 54.227.25.58
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Http response code 302 instead of 404
sam222




msg:4485873
 1:34 pm on Aug 17, 2012 (gmt 0)

In .htaccess file I have code ErrorDocument 404 [example...] If page not found it is redirecting to this URL but server returns 302 response code instead of 404. Should it not return 404 code.

 

g1smd




msg:4485983
 6:38 pm on Aug 17, 2012 (gmt 0)

The Apache manual specifically warns that the ErrorDocument should be a local path and file and never specified with protocol or domain.

lucy24




msg:4486038
 9:37 pm on Aug 17, 2012 (gmt 0)

Time for a chorus of:

I really hate this ### machine
I wish that they would sell it
It never does just what I want
But only what I tell it.


It is returning a 302 because you've told it to.

No I haven't. I've just named an ErrorDocument.

Yes you have, because you've given the full protocol-and-path. That creates a redirect. ErrorDocument declarations have to be in the form

ErrorDocument {number} /{nameofdocument}

for example

ErrorDocument 404 /boilerplate/my404.html

phranque




msg:4486071
 12:59 am on Aug 18, 2012 (gmt 0)

http://httpd.apache.org/docs/current/mod/core.html#errordocument
Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as http in front of it), Apache HTTP Server will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server. This has several implications, the most important being that the client will not receive the original error status code, but instead will receive a redirect status code. This in turn can confuse web robots and other clients which try to determine if a URL is valid using the status code.

sam222




msg:4486076
 1:28 am on Aug 18, 2012 (gmt 0)

I got it, it worked. Many thanks for replies and excellent support :-)

lucy24




msg:4486078
 1:48 am on Aug 18, 2012 (gmt 0)

I wish they hadn't included that last line. "Oh, good! I LIKE to confuse robots."

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved