Loading...

404 Error vs 410 Gone Error Code

Home / Development / 404 Error vs 410 Gone Error Code

Before we dive into How to fix a 404 error code or 410 gone error code, we just want to point out that these two error codes differ from one another. When redesigning a new website for a client or building a new website that will replace their old side, you will eventually come across one or more 404 error codes. We are going to show you how to simply fix these two codes using your .htaccess file. Let’s dive right in!

*Note always keep a backup of your .htaccess file before editing. The .htaccess file is a very powerful file and can take your site offline if incorrectly configured. It is important you add the path of the content folder and not the full URL.

What is a 404 Error Code?

To keep it simple, a 404 not found error code is a response sent back to the user indicating that the webpage could not be found. This can mean one of two things; The page a user is requesting has been removed or moved and the URL wasn’t changed properly, or the user typed the URL incorrectly. Make sure that it’s not URL being typed wrong before diving into fixing the 404 error.

How To Fix a 404 Error Code in the .htaccess file

We’ve used this method a lot and has proven effective for us. This method should only be used if you’re redirecting newly created pages that relate to older indexed pages. For example, if you have a website about pets and you create multiple pages about different types of pets, you don’t want to redirect a page about cats to a page about dogs. Users will catch on to this and either leave your website right away or hit the back button.

If you’re unsure of the anatomy of a URL look at this graphic we’ve made.

the anatomy of a URL listing the different parts of a URL

 

Not How do you redirect an Old URL to a related New URL? Write this rule in your website’s .htaccess file. If you don’t have a .htaccess file, create one.

 

301 redirect htaccess example

# Redirect
Redirect 301 /this-is-a-slug/this-is-a-article/ /this-is-a-new-slug/this-is-a-article/

This tells Google that /this-is-a-slug/this-is-a-article/ is old and the new URL is /this-is-a-new-slug/this-is-a-article/ and users will get directed to the new URL. Don’t abuse 301 Redirects in your .htaccess file. Remember this, if you have hundreds of 301 Redirects in your .htaccess file Google’s bots will take longer to crawl that file. This means that it’ll spend the majority of its time trying to read all the redirects. Keep redirects at a minimum and remember to scrub your redirects long after you’ve fixed your 404 errors.

 

What is a 410 Gone Error Code?

We did mention that the 410 Gone Error Code was much different than the 404 Error Code, here’s why the 410 gone error code is different. The 410 gone error code is a response that indicates a page requested by the user has been permanently deleted. The webmaster must have deleted the page or post and it no longer exists. Now the user should not expect any alternative redirection or forwarding addresses.

Google Search Console is reporting Pages that do not exist

Now that you know what 410 Gone Error Codes are, it’s time to report to Google that some of your pages have been deleted and it will never come back. There are multiple ways to write 410 Gone Error Codes, but for now, we will only stick to writing 410 gone error codes for Apache servers. This is the code we have added to our .htaccess file.

410 gone error htaccess

Redirect gone /this-is-a-slug/this-is-a-article/
ErrorDocument 410 default

After you have set up the 410 gone errors for the pages, they will disappear from the domain search results. Be mindful of these as sometimes you might get a 404 error code from these as well. Let’s hope that this doesn’t happen.

If you have any input, suggestion or other ways to fix these errors, we always love input. Don’t be shy and leave a comment down below.

 

 

Comments(0)

Leave a Comment