In search engine optimization, redirects must also be set depending on the purpose, for example to correct a 404 error. Among other things, the 302 redirect is available for this purpose.
What is a 302 forwarding?
If a page is redirected via a 302 redirect, this is a temporary redirect. The 302 redirect is therefore only used if the content can be found under a different path for a certain period of time. The target server thus provides the http status code “Found (Moved Temporarily)”.
In which case is a 302 forwarding used?
A 302 forwarding should also only be set if this change is only limited to a certain period of time. In the case of a permanent change, a 301 forwarding should be used instead.
The 301 redirect is always the right choice for a permanent change, such as a switch from http to https or a change to a new domain.
The 302 redirect is only useful if the website is not available for a short time (for example, due to a malfunction) or if you need to be redirected to a promotional page.
Instructions: 302 Set up forwarding
There are two ways to set up 302 forwarding.
.htaccess
The Apache module mod_rewrite must be installed for a redirect:
“RewriteEngine On
RewriteRule ^alteunterseite.html$ /neueunterseite.html [R=302,L]”
PHP
In the index.php to be redirected, the file in the head must be extended to include this code:
„<?php
header(“HTTP/1.1 302 Found”);
header(“Location: https://neue-domain.de”);
header(“Connection: close”);
?>“
With a content management system such as WordPress in particular, this should be solved using a plugin, as this significantly reduces the error rate and also provides an overview for large projects. The Rank Math SEO plugin is recommended for WordPress.
What influence does the status code 302 have on SEO?
The status code 302 gives the search engine crawler a hint and at the same time a request. On the one hand, the desired page is displayed to the visitor and, on the other, the redirect is not permanent. This means that the new content is ignored and nothing is changed in the indexing.