WebCitz Blog

How to Manage 301 Redirects

How to Manage 301 Redirects?

When you change the URLs of your website, it is important to redirect visitors from old pages to new ones. Otherwise, they will end up on a 404 page and lose interest in your site. In this blog post, we will discuss how to manage 301 redirects with Google Analytics and Apache web server configuration files.


How to Create a 301 Redirect

There are a variety of ways to do 301 redirects, but it’s usually done by modifying your site’s .htaccess file, which can be found in the root folder of your website.

But what if you can’t find the file? Well, there are two possible reasons:

  • There isn’t any .htaccess file – Create a new file in Notepad (Windows) and name it .htaccess. (remember to remove the .txt extension from the file name)
  • Your site is not using use Apache servers – Apache, Windows/IIS, and Nginx are the most popular web servers. However, the .htaccess file is used on only a few servers, with most systems preferring the Apache configuration system. Check if your web host uses Apache.


Follow these steps if your web servers running on Apache

1.) Redirect to a new page

Simply use the following code: Redirect 301 /old-page.html /new-page.html 
If you’re using WordPress, then it’s a simple case of using a redirection plugin. This will create a redirect page and automate the process.

2.) Redirect to a new domain

RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ https://newdomain.com/$1 [L,R=301,NC]

3.) Redirect from non-www to www (and vice-versa)

non-www to www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

www to non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]

Please note – It’s critical to pay attention to the order in which your htaccess file’s code is placed and ordered.If multiple instructions are placed in the wrong order (e.g., redirect chains, etc.), you may see unwanted side effects. This is something you should think about if you’re going to use a lot of 301 redirects in the same htaccess file.

4.) Redirect from HTTP to HTTPS

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

5.) Redirect from non-www to www and HTTP to HTTPS

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


Are 301 Redirects Harmful to SEO?

The connection between PageRank and 301 redirects is one of the most common topics for SEO experts.

Google PageRank is a metric that ranks the importance of a page by reviewing the number and authority of its links. PageRank is one of many ranking factors, but it’s generally believed to be a good indication as to how high your website will rank.

Back in the early days of SEO, 301 redirects were associated with PageRank loss, which meant they weren’t effective for improving SEO.

However, these days, Google has reportedly improved how it handles redirects and there’s very little lost. This means that 301 redirects can be used to pass PageRank from one domain to another.


How to Fix Existing 301 Redirect Issues on Your Website?

There is a chance you might already have 301 redirects on your site. If this is the case, be aware that you’ll want to avoid any infinite loops (where a redirect goes back and forth between two pages) as these will cause Google’s robot to make several passes through URLs.

If you’re using WordPress, then there are plugins available that can scan your site for existing 301 redirects.

Here are a few things to check if you have issues with your 301 redirects:

  • The HTTP version of your site should redirect to HTTPS
  • There’s no reason for a website not to use HTTPS.


You must also make certain that visitors to your site go to the HTTPS version, which necessitates the use of a 301 redirect.

To test if a 301 redirect is in place, search for the http:// version of your website. If everything is working correctly, then you should automatically be taken to the https:// version.
If this occurs, the majority of things should be OK. However, there may still be problems, such as:

  • HTTP to HTTPS redirect is only active on some pages (e.g., not subdomains)
  • HTTPS to HTTP redirects


Check for any issues, such as redirects not being implemented across all pages, with a crawl using Ahrefs’ Site Audit.

Remove 301 status code pages from your sitemap

To figure out the pages to crawl and index, Google relies on sitemaps.

As they are not indexed, URLs with 301 status codes are no longer technically available. If these pages are not removed from the website’s sitemap, Google will keep revisiting them as the site is re-crawled.

Here’s how to find pages like this:

  • Locate the URL for your sitemap. It will look something like: yourdomain.com/sitemap.xml
  • Use a tool like this to find all affected URL
  • Input all URLs into this HTTP status code checker
  • Display all affected pages


Alternatively, the Ahrefs’ Site Audit is a great tool for crawling your website, which will show all 301 redirect errors. The next step is to clean your sitemap by removing all of these URLs.

HTTP status code checker homepage
  • Change redirect chains

When there is a chain of two or more redirects between the starting URL and the destination, it’s known as a redirect chain.

While bots can follow these chains of redirects, it’s always recommended to redirect to the final URL destination. The fewer redirects, the better. As such, scan your website for any page on your website that redirects more than once.

We have two steps you must take to fix this issue:

  • Remove links in the chain – Page 1 should direct straight to page 3, not stop at page 2 along the way
  • Make sure all internal links are directed at the final URL – The redirect chains are made inaccessible to Google bots so that they can’t crawl them. It also improved the user experience for website users as there’s no redirect chains to slow things down
  • Change redirect loops

A redirection loop occurs when a URL redirects back to one of the chain’s original URLs. This results in an endless chain of redirections, which may perplex and ensnare any visitor to your website.
For example, this would happen if page 2 redirect to page 3, but page 3 also redirects to page 2 – oops!

This HTTP tool can be used to discover redirect loop problems in groups of 100. As usual, use the Afref Site Audit tool if you need to check more than 100 internal pages.

  • Broken redirects

A broken redirect is a link that takes you to a non-functioning page (such as a 4XX or 5XX HTTP response code).

These are troubling because neither users nor search engine robots are able to access the website, which will cause visitors to bounce from your website. The good news is that you can use checkers to assess the HTTP status codes.

  • Redirect pages with a 404 error

A 404 page is an error page returned to a user when the URL they’re trying to access cannot be found. These pages are an issue if:

  • They’re crawlable – If you have a 404 page that’s crawlable, it could be indexed and displayed in search results
  • Wasted authority – If they’re not viewable, backlinks to them have little benefit

To begin, open the Ahrefs’ Site Audit for “404 page” errors, as this might help with the first problem.
You can check backlinks by using Ahrefs Site Explorer. If there are any powerful backlinks, it’s a good idea to do a 301 redirect to another helpful page on your website.

It’s critical to redirect 404 pages to a more relevant location. Google considers irrelevant 301 redirects as mild 404s, so there’s no advantage in redirecting unless it’s to a comparable and relevant page.

Analyze your site’s backlinks and follow these easy guidelines for repairing broken links on pages that have no dofollow backlinks:

  • Returning a dead page to its original URL
  • Redirecting a (301) to other relevant pages
  • Replace all internal links to the deceased page
  • 301 redirects should be used instead of 302

For permanent redirects, avoid using 302 redirects.
Google advises against using 302 redirects for temporary relocations, and if possible, it is better not to use them at all. Meta refresh redirects are only used in cases of absolute necessity and extreme urgency.

View the Internal pages section of the Site Audit in Ahrefs’ for “Meta refresh redirect” and “302 redirect” problems to identify these pages.

Fortunately, both of these problems can be treated in just two steps:

  • Use a 301 if the redirection is intended to be permanent
  • Remove the redirect if it isn’t permanent

Remove or update any internal links to redirected pages that don’t assist visitors.

  • Look for redirect (301) pages receiving organic traffic

As they shouldn’t be in Google’s index, 301 pages should not receive organic traffic. If any are receiving visits organically, it means that Google hasn’t detected the redirect yet.
View the Overview report in Ahrefs’ Site Audit for “3XX page receives organic traffic” problems to look for 3XX pages with traffic.

You can also use Google Analytics to find this traffic by checking the pages report and filtering your organic sessions for 301s.

Paste the URL into Google Search Console’s Inspection tool to speed up the redirect procedure, then request indexing.

On a side note, if speed is important to you, you might be interested in our article on Top Tools For Testing Page Speed!

  • Examine for negative external 301s


Other useful websites are frequently linked to. However, these pages can sometimes get redirected elsewhere.

Consider the following scenario: you post a link to a helpful site, and then the following year the domain is bought by a new owner who redirects the site to a different site. As a result, it’s important to find negative external 301’s on a regular basis.

Fix this by finding the “External 3XX redirect” red alerts in the external pages section in Ahrefs’ Site Audit tool.

Next, go through the report, and find all redirects to other websites that are incorrect.

Conclusion

In conclusion, managing 301 redirects is essential to the success of your website. While it may seem like a lot of work, there are many tools available to help you identify and correct common problems.

It’s important to check for “bad” external 301s once a year, and always review your site’s internal links report for broken pages with dofollow backlinks.

One of the best ways to manage redirects is by using Ahrefs’ Site Audit tool because it lets you identify problems at a glance. It may be pricey, but it’s one of the best tools available for this task.

If you’re on WordPress and you keep having a missed schedule error, check out our blog article on What is a WordPress Missed Schedule Error so we can help you fix it!

Disclaimer: WebCitz, LLC does not warrant or make any representations concerning the accuracy, likely results, or reliability of the information found on this page or on any web sites linked to from this page. This blog article was written by Timothy A in his or her personal capacity. The opinion(s) expressed in this article are the author's own and may not reflect the opinion(s) of WebCitz, LLC.