What Are HTTP Error Codes? Common Codes + How to Fix Them

What Are HTTP Error Codes? Common Codes + How to Fix Them

If you have a website, you’re going to encounter HTTP error codes at least once in your life.

There could be more than one reason for an HTTP error response code. It might occur because a web page is no longer available (404 not found) or because of a problem with the server (500 internal error).

In this post, I’m going to tell you what HTTP error codes are. This will help you better understand the HTTP responses.

After that, I will discuss the most common HTTP error codes along with some tips to fix each code.

What are HTTP error codes?

HTTP status codes are responses issued for a client’s request made to a server. For example, when your client (your web browser) tries to connect to your WordPress site (the server).

Based on how the request is handled, the server shows different responses. These responses include redirects, server errors, client errors, and others as such. HTTP error codes are not part of web pages; instead, they are responses from servers about how the request is handled.

Not all HTTP status codes indicate errors. For example, some just communicate that a page has been moved, either permanently or temporarily. But if you are experiencing errors, the HTTP error codes that you see will help you figure out what the problem is.

Now that you know what it is, let’s dig into some of the most common HTTP error codes and status codes and how to fix them.

Seven most common HTTP error codes and status codes

“401 Unauthorized”

First on our list of HTTP error codes is 401. A 401 message means the server received an unauthenticated request.

In this error, a message announces that the page couldn’t load because of invalid credentials for whatever reason.

How to fix it?

It could be possible the login URL has changed, or the URL you entered is incorrect. However, if that’s not the case, try clearing the browser cache and cookies.

Full guide to fix 401 error code ?

“404 Not Found”

A 404 status code is a common HTTP error code on the internet. This HTTP response is generated when a page the user is looking for cannot be found on the server. There could be multiple reasons behind 404 occurrences. Perhaps because the webmaster has deleted the page or the URL you have entered is incorrect (since it’s a client-side error).

How to fix it?

Fixing a broken link (or, more specifically, a 404) is still an essential maintenance task. If you are glutton for work and won’t mind taking the longer route, use the .htaccess method. But a more natural way to do this is by installing the Redirection plugin from the WordPress directory. You can then redirect it to any webpage on the site.

Full guide to fix 404 error code ?

“500 Internal Server Error”

A 500 Internal Server Error is a generic error that displays when something is wrong with your server. Because it’s a generic error message, there are a number of different causes including issues with WordPress plugins, PHP issues, database problems, and more.

How to fix it?

Fixing the 500 Internal Server Error is a bit onerous as more than one reason is to blame for its occurrence. You’ll probably want to read the full guide for this one.

Full guide to fix 500 Internal Server Error ?

“502 Bad Gateway”

Unlike other HTTP error codes, 502 is different. A bad gateway occurs when one server on the internet receives an invalid response from another server. A 502 HTTP status code will be tacked on a screen when the server takes longer than expected to complete a request.

How to fix it?

Most of the time this can be fixed by simply refreshing the browser, or clearing the browser cache. If you have just migrated to the site, try waiting for 24 to 48 hours. You can even reach out to the hosting provider to check with them. Sometimes, a third-party CDN service or WordPress plugin could be the reason behind your 502 response. Try switching the WordPress theme to another if the fixes mentioned above don’t work.

“301 Moved Permanently”

An HTTP 301 is when a specific webpage is permanently moved to a different URL. It’s not an error per se, but it does communicate important information.

It can be on a page-level where you get pointed on another similar post (or even homepage for that matter) or a domain level.

How to fix it?

To make sure the redirection is flawless, check the redirect setup. If you have used a WordPress plugin, try switching it with Redirection. If you used the .htaccess file to perform the redirection, verify that you did it correctly. Here’s how to do that. Keep the domain level redirection for a few months, so Google knows the resource is moved permanently.

“302 Found”

This HTTP status code is similar to the 301, but it is used for a temporary redirect. This response tells Google that the page is moved temporarily and will be back to the original URL at some point. If done correctly, it will redirect the user to another URL in a couple of seconds.

How to fix it?

The easiest way to set up a 302 redirect is by using a WordPress plugin. You can install and use Rank Math from the WordPress directory.

“410 Gone”

This 410 Gone error is similar to the 404 response. Think of this as a permanent 404. When a webmaster decides to remove a post or page forever or republish it on another site, they can use this code.

A 410 response tells Google the requested resource is permanently removed from the internet and will not reappear. This makes it easier to get the page de-crawled or de-indexed from Google.

How to fix it?

There are multiple reasons behind a 410 gone error. First, check the input URL and make sure it’s correct. Next, try debugging the update on the WordPress website. Uninstall the WordPress plugins or other third-party extensions. If none of this works, then it’s a problem from the server end. Find the .htaccess file. Next, locate the word “RewriteXXX” in the .htaccess text editor and enter the following code:

RewriteEngine on
RewriteRule ^(.*)$ http://yourwebsitename.con/expired_page $1 [R=410,L] 

When entering the code, replace [http://yourwebsitename.con/expired_page] with the URL that is expired, or where you’d like to add 410 responses.


Now that you learned about the most common HTTP error codes and status codes, it’s time to fix them on your site and improve your site’s user experience and SEO.

There are also some other ways to improve how your site works with HTTP error codes. For example, you could create a custom 404 page that visitors will see when they try to visit a page that doesn’t exist.

Do you have any questions about HTTP status codes? Are you seeing an error and confused about what it means? Let us know in the comments!

Free guide

5 Essential Tips to Speed Up
Your WordPress Site

Reduce your loading time by even 50-80%
just by following simple tips.

Keep reading the article at ThemeIsle Blog. The article was originally written by Pulkit Bhardwaj on 2020-03-17 06:09:12.

The article was hand-picked and curated for you by the Editorial Team of WP Archives.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

Your email address will not be published. Required fields are marked *

Show Your ❤️ Love! Like Us
Scroll to Top