Optimize web mass 301 redirects how

301 vs. 302 Redirect - Redirects and their characteristics

With the 301 or 302 redirect, SEOs and webmasters have a common form of permanent or temporary redirect available. But when should you use which redirect? We have put together the answers for you here.

Predominantly server-side redirects

Redirects mostly work via an entry in the htaccess file. This is a small text file for the Apache server that contains instructions for the server. If a client calls a URL that is to be redirected, the server receives the command to redirect the client to the new URL. The .htaccess file is loaded from the server every time a page is accessed.

So much for the functional principle of server-side redirects. Elsewhere in the magazine we have dedicated a general guide to redirects. Today, however, we are primarily concerned with the 301 and 302 redirects. Let's start with the 301 redirect.

When do I use a 301 redirect?

A 301 redirect is the most significant redirect for SEO purposes. It ensures that one URL is permanently forwarded to another. Therefore the status code issued by the server is also 301 - moved permanently. The redirection forwards Linkjuice from the "old" to the "new" URL.

The 301 redirect is recommended for the following purposes:

    Domain transfer: In this case, it is ensured that the original URLs and directories are redirected to the new URLs and directories. Internal 301 redirects for individual URLs should always be avoided as far as possible. Otherwise the Googlebot also has to follow several redirects, which wastes crawl budget. At the same time, you increase the loading speed without the “intermediate steps” of the 301 redirect. However, if URLs contain external links, individual pages can be forwarded to get the link juice.

    Change of the website protocol: If you encrypt your website with an SSL certificate via https, a 301 redirect makes sense to redirect from http to https.

    Changes to the URL structure: If you should change the directories of your website and thus the URL structure, a 301 redirect can ensure that users can immediately find the new URLs without detour.

    Relocation of individual documents: If, for example, you offer a PDF for download under a certain URL, but you have redesigned the download area, a 301 redirect can refer to the new download target.

In principle, the 301 redirect is suitable to prevent duplicate content, to maintain the usability of your website and to offer your users a perfect user experience. Ultimately, the redirect is a sensible and useful tool to optimize the user experience.

A 301 redirect can be set up indefinitely. Google itself does not specify how long a 301 redirect must exist so that it can be removed again. Basically, you should always wait until Google has indexed the new URLs.

To test whether a new URL is already indexed, you can do a site query.

When is the 302 redirect used?

The main difference between a 301 and 302 redirect is the duration. While the 301 redirect is “permanent”, the 302 redirect is temporary. What both redirects have in common: They pass on pagerank.

While the new URLs of the 301 redirect are added to the Google cache and thus indexed, there is no cache of the redirect destinations in the case of a 302 redirect.

Possible use of the 302 redirect:

  • Redirecting seasonal product urls: If you run an online shop and start a special campaign in which primarily seasonal products are to be put in the foreground, you could use a 302 redirect to switch from the "old" to the "current" products.
  • Forwarding for tracking or website tests: If you want the performance of an action page or a newly designed website, you can redirect the old URL to the test page. Based on the results, you can then decide whether the new version should be implemented.

This is how a 301 or 302 redirect is set up

In most cases the 302 or 301 redirect is implemented with the .htaccess file of the Apache server. Forwarding via PHP is also possible. This variant can be used for documents, for example, and is implemented via the header of the document.

Forwarding via .htaccess

With such a forwarding, the module "mod rewrite" of the Apache server must be activated. For this purpose, various instructions are inserted in the .htaccess file that tell the server how to proceed with a special URL or directory.

An example: In this case, page1 forwards to page2 permanently.

RewriteEngine On

RewriteBase /

RewriteRule page1.html page2.html [R = 301]

If a 302 redirect is implemented, you have to replace 301 with 302 in this example.

302 vs. 301

What use it for?temporary or permanentWhich forwarding?
Domain transferpermanent301
Changes to the URL structurepermanent301
Geotargetingtemporarily302
Affiliate campaigntemporarily302

Does a 302 redirect pagerank pass on?

Basically: all redirects such as 301 or 302 redirects pass on pagerank. The only difference between a 301 and 302 redirect is that Google will or will not cache the destination URLs.

Check status codes with Ryte - that's how it works

The tool Ryte Website Success In the indexability area, after a click on status codes, you can also see which pages are redirecting via 301 or 302 redirect.

Illustration 1: Display status codes with Ryte Website Success.

After clicking on the yellow tab, you will be shown all URLs that output the status code 301 Moved permanently. You can also see the forwarding destinations with the tool.

Figure 2: Display the forwarding destinations of the 301 redirects with Ryte.

By regularly checking redirects, you make sure that your website offers a good user experience. This creates good conditions for Google to receive positive user signals that are honored by Google and can ultimately contribute to good visibility in the SERPs.

Conclusion

301 redirects are a tried and tested means of avoiding duplicate content. They are mainly suitable for permanent use. Like 302 redirects, they pass on pagerank, thus maintaining the "blood flow" to your site with link juice.

You should only use 302 redirects to a limited extent and really only for temporary redirects, since the landing pages are not cached by Google.