Hi, I have added httpErrors to my web.config file as so.... <httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="401" subStatusCode="-1" /> <error statusCode="401" prefixLanguageFilePath="" path="/Errors/401-Not-Logged-In.aspx" responseMode="ExecuteURL" /> <remove statusCode="403" subStatusCode="-1" /> <error statusCode="403" prefixLanguageFilePath="" path="/Errors/403-Not-Authorised.aspx" responseMode="ExecuteURL" /> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/Errors/410-Page-Gone.aspx" responseMode="ExecuteURL" /> <remove statusCode="410" subStatusCode="-1" /> <error statusCode="410" prefixLanguageFilePath="" path="/Errors/410-Page-Gone.aspx" responseMode="ExecuteURL" /> <remove statusCode="500" subStatusCode="-1" /> <error statusCode="500" prefixLanguageFilePath="" path="/Errors/500-Server-Error.aspx" responseMode="ExecuteURL" /> </httpErrors> Currently I am changing 404 errors to 410 errors to give Google a strong indication that the pages that no longer exist have gone for good. I have also pages with parameters that have been removed. Currently when these are requested Google will get a 500 error. Am I correct in thinking that I should update my code as follows to return a 410 response and stop Google repeatidly hitting pages that no longer exist? <remove statusCode="500" subStatusCode="-1" /> <error statusCode="500" prefixLanguageFilePath="" path="/Errors/410-Page-Gone.aspx" responseMode="ExecuteURL" /> The Response.StatusCode is set to 410 in 410-Page-Gone.aspx. Will
Let me get this straight to make sure I understand what you are trying to do. You want to force HTTP status codes, such as HTTP 404, to return a status code of 410? Is that correct? I don't think that is possible. What you are looking at in your web.config file is the custom error handling. All it does is to display a specific message (web page) depending on the HTTP status code. It does not actually alter the HTTP status code. Something like this may require a redirect script so you can define the HTTP status code, but I think that will be fairly tricky to do.
Yes force a 410 status to be returned. I tested it with the Telerik Fiddler app and it showed that a hard 410 was being returned without any redirect etc. I think the 410 is the way to go to tell Google in no uncertain terms that a page has gone.