The Art of Building Successful Websites10/01/2021
502 Bad Gateway: What Is It and How to Fix It05/02/2021
Are you interested in learning about 301 redirects and how to fix the most common errors? You’ve arrived at the right place. Let’s imagine that you’re setting up a new webpage or a full website. Or you’re maybe migrating your site. There could also be a typo in your domain name. You believe that it’s no longer practical to use the same URL. What do you do?
You use a 301 permanently moved status code. These types of codes are meant to route your users to a new location. It’s that line that says: “The requested document has been moved permanently.” Your users will request to access a page but they will be sent somewhere else. Here’s everything you should know about the 301 status code and how to find and fix a 301 error.
What Does 301 Moved Permanently Mean?
There are many different kinds of HTTP response status codes. They all tell a user whether a specific HTTP request has been successfully completed. There are five classes:
- Informational responses (such as 100 Continue and 101 Switching Protocols)
- Successful responses (such as 200 OK and 204 No Content)
- Redirects (such as 301 Moved Permanently and 302 Moved Temporarily)
- Client errors (such as 400 Bad Request and 404 Not Found)
- and Server errors (such as 500 Internal Server Error and 508 Loop Detected)
The 3xx HTTP status codes indicate a redirection. A redirect will send users and search engines to a different URL from the initial. There are different kinds of 3xx status codes – including 302, 303, and 307 – and each one of them has a different meaning.
You should use 301 status codes when you’re permanently replacing one URL for another. Meaning, you’ll be redirecting both users and bots to the new URL. Example: blog.website.com redirects to website.com/blogIf you were talking to a real person, it would go something like this:
You: This page has moved permanently, and we don’t plan on moving it back.
Browser: Okay, got it. I’ll send your users to your new URL.
The new URL will replace the old URL in the search results, and the old URL will eventually disappear. Link equity will pass from the old URL to the new URL. So, every time you’re doing site migration or killing an old page and replacing it with a new page, you want to be doing a 301 Moved Permanently redirect.
What is the difference between 301 and 302 redirect?
301 vs. 302 redirects. Feeling confused about which one you should use? Don’t worry, you’re not the only one. Even in 2019, website owners are unsure about which type of redirect is best for SEO. There are many reasons why you might want to use a redirect. The most common reasons include:
- You’ve created a new website.
- You’ve created a new page.
- You have a broken URL.
- You’re fixing a page and want to send users to a different page.
The choice largely depends on the purpose of the redirect. Understanding the difference between the two is crucial when it comes to your SEO. A 301 redirect informs search engines that a website or page has been moved permanently. You should use an HTTP 301 when you’re migrating a site or creating a new website. It’s also appropriate to use a 301 if you’re joining two websites together. 301 also works if you’re making changes to the URL that are not intended to be reverted. A 302 redirect tells search engines that a website or page has been moved temporarily. You should use this redirect if you’re redesigning or updating a website or a page. It’s also appropriate to use the redirect when you want to test out a new page and get consumer feedback. Make sure you use a 302 redirect only if you’re planning on bringing the old website or page back.
How long does a 301 redirect last?
A permanent HTTP 301 usually redirects your site around a year or longer. After that, make sure you check to see if users are still being sent to your new URL.
How do I fix 301 redirects?
Any website owner will come across an error code 301 at some point in their life. Knowing what the problem is and how to fix it can be crucial for the health of your website. Regular website maintenance is a must when dealing with this kind of issues, here are the most common and the best way to resolve them
Ensure your HTTP version redirects to your HTTPS
You should consider using HTTPS on your site as it can keep your visitors’ data safe and secure. What’s more, Google uses HTTPS as a ranking signal. Meaning, not using HTTPS can hurt your online rankings. By doing so, Google wants to encourage all website owners to switch from HTTP to HTTPS to ensure everyone has a safe online experience. There’s no cons to using HTTPS in 2019.
But using HTTPS has no value if your users are not redirected from the HTTP version to the secure HTTPS version. Meaning, you’ll have to use an HTTP 301 between the HTTP and HTTPS versions.
To see if the 301 redirect works between your two versions, check the URL bar of your homepage.
You’ll see the following:
Now erase the “s” and change the URL to https://yourwebsite.com/ and click enter. If everything works properly, you should be redirected to the HTTPS version of your site..
Remove 301 redirects from your sitemap
Google reads your sitemap file to more effectively crawl your site. But since your redirected pages don’t exist, there’s no point in Google crawling them. To find your 301 status codes and delete them, this is what you can do:
- Go to yourdomain.com/sitemap.xml (keep in mind that your sitemap URL might be different as there are exceptions).
- Use a URL Extractor to download a list of your URLs.
- Paste the list into this free tool.
- Filter the list with a 301 status code.
- Delete the 301 URLs from the sitemap file and replace them with the final URL.
A redirect chain happens when there’s more than one redirect between the original URL and the final URL. For example, Page 1️ Page 2 ️ Page 3. However, Google advises against redirect chains as they can negatively affect UX and slow down your site.
Redirect chains are also bad for your SEO. It’s estimated that 301 redirects only pass about 85% of link equity. Meaning, the more redirects there are, the worse it gets.
You should redirect to the final URL. Here are a few tips:
- Use this tool to check for redirect chains.
- Once you find them, replace the redirect chain with only one 301 redirect. Instead of Page 1 ️ Page 2 ️ Page 3, the redirect becomes Page 1 ️ Page 3.
- Or you can replace internal links to redirected pages with direct links to the final URL.
A redirect loop happens when one URL redirects users back to the other URLs in the chain. For example, Page 1️ Page 2️ Page 1️ Page 3.
If this is an issue, you’ll want to fix it as quickly as possible.
Check out this tool that’s free to use for up to 100 URLs and look for an exceeded maximum number of redirects errors.
Once you find the redirect loops, you can fix them in two ways:
- Change the HTTPS response code to 200 if you don’t want the URL to redirect.
- If the URL is supposed to redirect, then remove the loop and fix the final destination URL.
Fix your broken redirects
Broken redirects lead to a page that doesn’t exist. For example, Page 1 (301) > Page 2 (404). This error can negatively affect your online rankings and user experience.
Use the same tool we’ve mentioned above to check for broken redirects in batches of 100.
Once you find the errors, you can fix them by:
- Bringing back the dead page, or,
- Deleting the in-links to the redirected URL.
Replace 302 redirects with 301
302 redirects are only for temporary redirects and you should never use them for permanent moves. If you happen to have a 302 redirect for a permanent move, you should remove it or replace it with an HTTP response status code 301 Moved Permanently.
Check for 301 redirected pages that receive traffic
A 301 code tells the browser that a page has moved permanently to a new URL. Meaning, that page shouldn’t get any organic traffic. If you added the HTTP 301 recently, then chances are Google will see it during the next crawl.
To check for redirected pages that are still getting organic traffic, use a tool like Moz, SemRush, or Ahrefs. Once you find the pages, remove them from your sitemap and re-submit them via Google Search Console.
Use a 301 redirect to redirect a URL to a new destination permanently. By doing so, you inform both search engine crawlers and visitors that this URL has changed and they will be redirected to a new destination. Make sure you always have a plan in place and use the redirects strategically. Inserting HTTP 301 in the right way will lead to huge gains in organic traffic. If you worried that your website has outstanding 301 Moved Permanently errors, follow the tips mentioned above to resolve them as fast as possible.