codeGEN
codeGEN

Reputation: 714

Using status code 500 for reporting unhanded errors

I am using header("HTTP/1.0 500 Internal Server Error"); in my php code to output internal errors, such as if there is a problem with a database query.

The process will be to log the exception & return the status code 500. I am using this technique because then the ajax requests error function will automatically detect this as a bad response and the $(document).ajaxError(); will be triggered. Though this works, I am not sure whether this might have any negative impact on SEO practices. Can anyone tell me whether there will be any negative impact of using this.

Upvotes: 0

Views: 111

Answers (1)

Your Common Sense
Your Common Sense

Reputation: 157828

Quite contrary, this will make an extremely positive impact on SEO practices.

Search engines encourage you to use proper HTTP codes instead of spitting 200 OK for the erroneous page. In case of 200 it will index the error page instead of just marking it to visit later.

Though I am not sure if bots ever call your AJAX routines.

Upvotes: 1

Related Questions