Blog Post

SEO

Nadine

Wolff

published on:

18.11.2015

On-Page Optimization: How to Successfully Implement a 301 Redirect

Table of Contents

No table of contents available
No table of contents available
No table of contents available

The 301 redirect technically transmits the HTTP status code 301 Moved Permanently. With this command, you signal to search engine bots and web browsers that a specific webpage content has permanently moved to a different URL and will henceforth be accessible at this new location. However, if you plan to only temporarily move content, you should use 302 redirects.

Why you should use 301 redirects

The good news right at the beginning: According to Google, 404 error pages do not affect a website's ranking. 404 error pages have a sensible function on the web and are part of a certain extent, according to the search engine service. Nevertheless, you should keep an eye on your 404 error pages and try to redirect them to another page where it makes sense to do so.

But when should you use 301 redirects? This type of redirect is particularly useful in three cases. 1) When the URL structure of a website changes; 2) When you perform a relaunch with a new URL structure; and 3) When the domain name of the website changes.

The advantage of 301 redirects is that users do not end up on a 404 error page. If this happens, there is a greater risk that the user will immediately leave the website. If you only use a standard 404 error page on your website that contains no specific call to action, the likelihood is very high that the user will visit competing sites.

Additionally, you can use 301 redirects to avoid duplicate content. Thanks to these, each webpage can only be accessed once. Google negatively rates duplicate content and downgrades such websites in the rankings. Websites that can be accessed via several URL variants of a domain, such as www.domain.de, www.domain.de/, domain.de, or https://www.domain.de, httpss://www.domain.de) are considered duplicate content. This is referred to as internal duplicate content.

Another advantage is that the PageRank is transferred with a 301 redirect, ensuring there is no loss in ranking. On the other hand, a 302 redirect does not pass on PageRank. For this reason, from an SEO perspective, this form of redirect is only applicable to temporarily moved content. Client-side redirects using Javascript and Meta-Refresh should also be avoided, as Google often suspects unauthorized manipulations here.

How to properly set up 301 redirects

Although 301 redirects are generally easy to create, numerous errors can creep in. In the worst case, it can result in the entire website becoming inaccessible.

There are different approaches to setting up a 301 redirect on web servers:

  • 301 redirect using PHP

  • 301 redirect using the .htaccess file

  • 301 redirect with NGINX

  • 301 redirect with Lighttpd

  • 301 redirect with IIS

The first two methods are the most widespread. Therefore, we focus mainly on these two options in this article.

The first recommended method to set up 301 redirects is by using the PHP "header" function. In this case, the source document must be a PHP file. The respective PHP code can be written directly into the index file of the document to be redirected. The source code looks as follows:

Weiterleitung via PHP

The second recommended method is setting it up using the .htaccess file. In this variant, the redirect is entered into the root directory of the web server. For this, an Apache web server with an activated mod_rewrite module must be present. In most web hosting packages, Apache, the activated mod_rewrite module, and a .htaccess are already available. To enter the 301 redirect into the .htaccess file, insert the following source code:

Weiterleitung via .htaccess1

If the mod_rewrite module is not activated or you cannot activate it for some reason, you can address the mod_rewrite module with the "RewriteEngine On" command. In this case, the code looks as follows:

Weiterleitung via .htaccess2

Both methods have their advantages and disadvantages. However, 301 redirects using the .htaccess file are considered the preferred method. Setting up 301 redirects using the .htaccess file is faster. The more redirects you need to set up, the greater the time saving. Instead of working on numerous files, you only need to edit one file.

Where exactly should I redirect?

To provide the maximum benefit for the user, 301 redirects should be as specific as possible. Ideally, a page should be redirected to a page whose content is the same as the original content (this is the case when restructuring the website) or as close as possible. For a subpage, this is usually another subpage and not the homepage.

Here is a fictional example for better understanding: You run an online shop for women's clothing. Your shop structure is as follows:

Bekleidungskategorien

For some reason, you remove all tank tops from your inventory. However, you continue to offer other tops like spaghetti tops and halter tops. In this case, you should redirect to the subcategory page Tops. However, if you remove tops entirely from your inventory, but t-shirts, shirts, and blouses can still be ordered by customers, then redirect to the category page Shirts.

The homepage should only be chosen as the new target URL if there is no corresponding page available anymore. This is the case, for example, if you discontinue the category Shirts entirely and there is no adequate successor category. In this case, you can redirect to the homepage of the shop.

Keep it simple

Basically, you can set up as many 301 redirects as possible. Theoretically, you can also set up various redirects for a specific page. There is no technical upper limit here. However, it is better to link directly to these in internal linking. You achieve this by adjusting the relevant links.

However, unlimited 301 redirects should not be set up per URL. But what is the drawback? Basically, the Google Bot follows every set-up 301 redirect, but not indefinitely. If multiple redirects are set up for a certain page, it can happen that the Google Bot stops at a certain point and does not follow the 301 redirects any further. According to Google employee Matt Cutts, the likelihood of reaching the target page decreases significantly after four to five redirects per URL. With six 301 redirects, the chance that the Google Bot will reach the target page is practically zero.

Redirection chains lead to losses in "link juice." The more redirection points are set up, the higher the loss. Additionally, each set-up redirect consumes resources, which can lead to increased loading times. Google no longer welcomes this.

Website operators should therefore strive to require only a single 301 redirect between the old and new URL. You do not need to worry that Google will follow your set-up redirect and recognize the content on the other website as successor content.

What we can do for you

Do you want to optimize your website and are looking for a reliable partner who can also help you set up 301 redirects? internetwarriors GmbH specializes in search engine optimization. Contact us.

Nadine

Wolff

As a long-time expert in SEO (and web analytics), Nadine Wolff has been working with internetwarriors since 2015. She leads the SEO & Web Analytics team and is passionate about all the (sometimes quirky) innovations from Google and the other major search engines. In the SEO field, Nadine has published articles in Website Boosting and looks forward to professional workshops and sustainable organic exchanges.

no comments yet

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Newsletter

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Newsletter

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Newsletter