HTTP status codes are server responses to a client’s request. These codes indicate whether the request was successful or encountered an issue. Common codes include 200 (OK), 404 (Not Found), and 500 (Server Error).
A 410 status code, also known as "Gone," informs clients that the requested resource has been permanently removed and will not be available again. Unlike a 404 code, which signals a resource could be missing temporarily, a 410 code confirms it’s gone for good.
The 410 status code is ideal when:
By issuing a 410 code, you ensure clients and search engines know the resource won’t return.
You can implement a 410 status code in various server environments. Below are some examples:
Apache .htaccess
RewriteEngine On
RewriteRule ^old-page$ - [G,L]
Nginx
location /old-page {
return 410;
}
PHP
From an SEO perspective, using a 410 status code ensures search engines like Google remove the page from their index. This can be beneficial when cleaning up outdated content and maintaining a streamlined site structure. Search engines recognize that a 410 means a page is permanently gone and should not be crawled again.
If you encounter a 410 error on your website, here’s how to resolve it:
Check if the Resource is Permanently Removed: Verify that the page or file triggering the error is no longer needed. If it was removed by mistake, consider restoring it.
Redirect to a Relevant Page: If the resource is permanently gone, set up a 301 redirect to guide users to an alternative page.
Review Links: Ensure all internal and external links pointing to the deleted resource are updated or removed.
Code Example for a Redirect (Apache)
Redirect 301 /old-page /new-page
In this example, users who visit the deleted "old-page" will be directed to "new-page."
By following these steps, you can address and fix 410 status code errors effectively.