Forum Moderators: phranque

Message Too Old, No Replies

Error 500 comes when invalid page comes.

         

Amtoj

5:45 am on Jun 17, 2010 (gmt 0)

10+ Year Member



Hello guys .... I have website which has some dynamic page .... - which include article posting so dynamic page comes .... now the problem is that sometimes due to spamming I have to delete those pages but befor emy deletion it sometimes gets indexed in google so when a user access these deleted pages frm google it gets HTTP Status 500 error so guys help me out to get rid of this issue ....

someone told me that there is code that redirects ur HTTP Status 500 error to homepage/ desired page ... plz guide me


Best Regards
Amtoj Singh

phranque

9:22 am on Jun 17, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the correct response here would be 404 (Not Found) or 410 (Gone).

you could certainly link to the desired url from the 404 page and/or use a meta-refresh or whatever client-side method to reach the home/desired page as long as it's not a 200 OK response.

redirect with 301 or 302 only if you have a resource that is a relevant replacement for the indexed-then-deleted content.

ronnyskog

12:37 pm on Jun 17, 2010 (gmt 0)

10+ Year Member



If you want to redirect to a custom error page you can edit .htaccess.

Add this line to the file (edit it with a text editor like Notepad):

ErrorDocument 500 /pageofyourchoise.html

jdMorgan

1:41 pm on Jun 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The most likely cause of this problem is that a custom 404 error document has already been defined (for example, using your control panel) and that custom 404 error document does not exist.

Very often, the name of this custom error document defined by control panels is "404.shtml."

If this is the case, then your server error log will show the problem.

The solution is to un-do the custom 500 error document declaration in your control panel. You could then define a custom error document in your .htaccess file. Alternatively, you could use your control panel to declare the custom error document, but declare the path to an 500 error page that does actually exist.

However, I do not recommend declaring a custom error document for 500-Server Errors. Doing so introduces additional dependencies for error handling, making the server vulnerable to many more failure modes than it would be if you used the default 500-Server Error handling. Basically, error handling should be kept as simple as possible, and declaring a custom 500-Server Error page for no other reason than to preserve the 'look and feel' of all pages across your site is not a very wise choice.

Defining custom error documents for the other common errors (403, 404, 410, etc.) does not present so much of a problem.

Note that you must define the path to custom error documents as relative to the server root (your "home page" directory." As in ronnyskog's example above, start the URL-path with a slash, and do not declare a full URL (starting with "http://www.example.com/" or the result will be that the error page will be served with a 302-Found server status followed by a 200-OK status instead of the correct error status. This can make a mess of your search engine rankings, especially with 404 and 410 errors, as the search engines will not be able to tell which resources actually do and do not exist on your server (they will always see a 302 redirect followed by a 200-OK, not matter what URL they request).

Once your configuration has been corrected, I strongly recommend testing your server's error responses using a server headers checker such as the Live HTTP Headers add-on for Firefox and other Mozilla-based browsers. Make sure that the server responds with the correct status code in all cases, and that error documents are served with no intervening 301, 302, 303, or 307 redirects.

Jim

Amtoj

11:38 pm on Jun 17, 2010 (gmt 0)

10+ Year Member



k thx buddies .... for ur help ... hope it will work....