DE

EN

Nadine

Wolff

published on:

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

Table of Contents

No table of contents available

Technically speaking, a 301 redirect transmits the HTTP status code 301 Moved Permanently. With this command, you signal to search engine bots and web browsers that specific website content has been permanently moved to another URL and will be accessible at this new address moving forward. However, if you only plan to move content temporarily, you should use 302 redirects instead.

Why You Should Rely on 301 Redirects

Here's some good news right off the bat: according to Google, 404 error pages do not negatively impact a website's ranking. The search engine giant notes that 404 pages serve a practical purpose on the web and are simply part of the landscape to a certain extent. Nevertheless, you should keep an eye on your 404 error pages and try to redirect them to another relevant page whenever it makes sense.

So, when should you use 301 redirects? This type of redirect is especially useful in three scenarios: 1) when the URL structure of a website changes; 2) when you launch a redesign or relaunch with a new URL structure; and 3) when the website's domain name changes.

One major benefit of 301 redirects is that users won't land on a 404 error page. When that happens, there's a much higher risk that visitors will leave your site immediately. If your site only displays a standard 404 error page without a clear call to action, chances are very high that users will just bounce over to a competitor's site.

Additionally, you can avoid duplicate content by using 301 redirects. Thanks to these, each web page can only be accessed through one definitive URL. Google views duplicate content negatively and may lower the rankings of affected pages. Duplicate content includes, for example, pages that can be reached via multiple URL variations of a single domain (like www.domain.com, www.domain.com/, domain.com, or http://www.domain.com, https://www.domain.com). This is referred to as internal duplicate content.

Another advantage is that PageRank is passed along with a 301 redirect, helping prevent ranking losses. A 302 redirect, on the other hand, does not pass PageRank. For this reason, from an SEO perspective, 302 redirects are only suitable for temporarily moved content. You should also avoid client-side redirects using JavaScript and meta refresh tags, as Google tends to view these as potential manipulation.

How to Set Up 301 Redirects Properly

Even though setting up 301 redirects is fairly straightforward in principle, mistakes can easily creep in. In the worst-case scenario, your entire website could become inaccessible.

There are several ways to configure a 301 redirect on web servers:

  • 301 redirect with PHP

  • 301 redirect via .htaccess file

  • 301 redirect with NGINX

  • 301 redirect with Lighttpd

  • 301 redirect with IIS

The first two methods are by far the most common. That's why we'll focus primarily on these two options in this article.

The first recommended method is setting up 301 redirects using the PHP "header" function. In this case, the source document must be a PHP file. You can write the corresponding PHP code directly into the index file of the document you want to redirect. The source code looks like this:

Weiterleitung via PHP

The second recommended option is configuring redirects via the .htaccess file. With this approach, the redirect is added to the root directory of the web server. This requires an Apache web server with the mod_rewrite module enabled. Most web hosting packages already include Apache, an enabled mod_rewrite module, and a .htaccess file. To add the 301 redirect to the .htaccess file, insert the following code:

Weiterleitung via .htaccess1

If the mod_rewrite module isn't enabled, or if you can't enable it for some reason, you can still activate it using the "RewriteEngine On" directive. In that case, the code looks like this:

Weiterleitung via .htaccess2

Both approaches have their pros and cons. However, 301 redirects via the .htaccess file are generally considered the preferred option. For starters, setting up 301 redirects through the .htaccess file is much faster. The more redirects you need to configure, the more time you'll save. Instead of editing dozens of separate files, you only need to update a single file.

Where Exactly Should You Redirect To?

To provide the best possible experience for your users, 301 redirects should be as specific as possible. In other words, a page should ideally be redirected to a page whose content is identical to the original (as is often the case during a website restructuring) or as close to it as possible. For a subpage, this usually means redirecting to another relevant subpage—not the homepage.

Here's a quick example to illustrate: imagine you run an online boutique for women's clothing, with a structure like this:

Bekleidungskategorien

For some reason, you decide to stop carrying tank tops altogether. However, you continue to offer other tops like camisoles and halter tops. In this case, you should redirect the tank top page to the "Tops" subcategory page. But if you drop tops from your lineup entirely—while still selling t-shirts, button-downs, and blouses—then you should redirect visitors to the broader "Shirts" category page instead.

The homepage should only be chosen as the new target URL if no equivalent or relevant page exists anymore. This would happen, for instance, if you completely discontinue the entire shirts category and there is no suitable replacement category. In that scenario, redirecting to the shop's homepage makes complete sense.

Keep It Simple

In general, you can set up as many 301 redirects as you need. Theoretically, you can even point multiple redirects to a single page—there's no technical limit here. However, it's always best practice to link directly to the new target URL in your internal links. You can easily achieve this by updating the relevant internal links across your site.

That said, you shouldn't string together endless 301 redirects for a single URL. Why avoid this? While Googlebot will follow redirects, it won't keep following them indefinitely. When multiple redirects are chained together, Googlebot may eventually stop and give up. Former Google engineer Matt Cutts noted that once you hit four to five chained redirects per URL, the likelihood of the bot dropping off rises significantly. With six 301 redirects in a chain, the chance of Googlebot ever reaching the final destination page is practically zero.

Redirect chains also lead to a loss of "link juice"—the more hops in the chain, the more equity is lost. Furthermore, every redirect consumes server resources, which can slow down page load times. And slow load times are something Google really frowns upon these days.

Website owners should therefore strive to keep things to a single 301 redirect between the old URL and the new one. That way, you won't have to worry about whether Google will follow the redirect and properly recognize the content on the new page as the successor.

How We Can Help

Looking to optimize your website and searching for a reliable partner to help you configure your 301 redirects? internetwarriors GmbH specializes in search engine optimization. Get in touch with us today.

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.

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Legal Information

Newsletter

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Legal Information

Newsletter

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Legal Information

Newsletter