Whether it’s a domain move, changes in the URL structures, redirect users to mobile website versions that match their end devices, or for many other reasons, redirects are needed. If done correctly, redirects help with search engine optimization and ensure that the page ranking of the old page is inherited by the new one. In addition, redirects help to give users the optimal user experience and thus to keep it or to win it over. Incorrect or missing redirects, on the other hand, not only damage the page ranking. In this article, we will explain the different variants of the redirects and what you have to pay attention to in this regard.
What are redirects?
A redirect by a client from one URL to another URL is called a redirect. We would like to briefly introduce you to the most common and most important reasons and purposes of the redirects:
- Moving from an old to a new domain
- Restructuring of the page directories
- Redirecting the user to a URL designed for mobile devices
- To prevent duplicate content
- To use several websites under one domain
- For redirecting to the user-relevant region when geotargeting
Good redirect, bad redirect
A good redirect means moving a website, redirecting it to the regional page of the website and to the mobile version for smartphones and tablets by means of geotargeting. These redirects have no disadvantages for the user.
A bad or malicious redirect is when the user is redirected to a page that he did not want to visit. These mostly spam sites or sites with questionable content. However, search engines usually recognize and punish this misdirection.
301, 302, 307 or 308 redirect?
There are server-side and client-side redirects as well as permanent and temporary redirects that are relevant for search engine optimization (SEO). Forwarding codes such as 301, 302 and 307 hide different types of redirects, which we will go into in more detail.
The status code 301 (HTTP / 1.0) is the most common redirect and means “moved permanently. The 301 redirect is therefore server-side and permanent, which means that the redirect informs the client who requests that the desired content has been permanently moved. This forwarding also works when changing the request method from POST to GET. This redirect is also referred to as HTTP forwarding or server redirect because it was written in the HTTP protocol and is understood by every client (bot or crawler). Search engines like Google learn from the redirects via their bots that the old URL no longer exists and the search engine removes it from the index and inherits the page-ranking to the new URL to which it was forwarded. In the case of a server-side 301 redirect, a client requests a URL. This sends a request to the web server, which responds with a status code. This means that a redirection to another address has taken place, i.e. a redirect.
The client calls up a new URL to which the user is redirected.
The aim of a 301 redirect is therefore to make content that was previously found under one URL (domain) available to the user on another, at best without the user noticing that he is being forwarded. To achieve this, a server-side, permanent 301 redirect is set. An incorrect or missing redirect leads to the dreaded 404 pages, i.e. the error pages with the error code ” 404 “. The chance of permanently scaring the user off with such a user experience is great, and the bots from Google are also hard hit with 404 error pages and duplicate content (DC).
The consequence is a deterioration in the page ranking, which is why the classic 301 redirects are so important.
- Permanent relocation of the domain (cacheable) or a document / file
- Restructuring of a website in which the URLs change (cacheable)
- Change from insecure HTTP to secure HTTPS
- When bundling URLS (cacheable)
Note: The redirect must remain in place until the search engines have indexed the new page. You can do a site query on Google if you want to know if all new URLs have already been indexed.
To set up a 301 redirect via PHP or an .htaccess file:
The “mod rewrite” is required for forwarding via -htaccess
- Example of a .htaccess file:
- RewriteEngine On
- RewriteBase /
- RewriteRule index.html newindex.htm [R = 301]
- For the introduction via PHP you have to include a code snippet in the header of the HTML document. The PHP redirect is not a server-side redirect
The status code 302 (HTTP / 1.0) is a temporary client-side forwarding that states that the desired content is only temporarily available under a different URL. The new and the old URL are both listed and thus provide duplicate content, which is not well received by search engines and can lead to a poorer ranking or even exclusion from the search engine index. This forwarding also works when changing the request method from POST to GET.
Examples of the 302 redirect:
- Geotargeting (not cacheable)
- Affiliate campaign (partially cacheable)
The 302 redirect can also be set up via PHP or .htaccess file.
Example of a .htaccess file:
- RewriteEngine On
- RewriteBase /
- RewriteRule index.html newindex.htm [R = 302]
This redirect is basically the same as 302, only that, unlike 302 and 307, it is never cacheable. The status code 303 (HTTP / 1.1) is also temporary and has largely been replaced by 307. This forwarding also works when changing the request method from POST to GET.
“Move temporarily” – a temporary redirect that is considered a better successor to the 302 redirect (HTTP / 1.1) and is therefore preferred for server maintenance. Here, too, there is duplicate content as with the 302, which always poses a risk for the ranking. For this, a PHP file with the redirect is written, which is saved in the root directory. Then a new htaccess file with the name htaccess.307 is created. This forwarding does not allow the request method to be changed from POST to GET.
This redirect is used for a short-term redirect. Examples of 307 forwarding:
- Geotargeting (not cacheable)
With 308 redirects it is a permanent forwarding as with the status code 301. Unlike the redirect 301, the 308 (HTTP / 1.1) does not allow a change of the request method from POST to GET. In addition, the status code 308 is also only permitted for http 1.1-compatible servers, while the old redirect code 301 is still downward compatible.
How do meta refresh tag redirects work?
Meta refresh tag redirects are an emergency solution if you do not have access to the server configurations. A provisional forwarding is created with a code for a meta refresh tag as an HTML command.
Which redirects for which goals?
- Forwarding after domain transfer to new domain: 301
- Forwarding to a new version of a product: 301
- Forwarding to the regionally relevant version of the website using geotargeting: 307, 303, 307
- Redirect to the mobile version of the website for smartphones and tablets: 301
- Short-term redirection to new URLs when the website is rebuilt: 307 (or 302 – but not so recommended)
- Forwarding from insecure HTTP to secure HTTPS: 307
Avoid so-called forwarding chains
It happens, again and again, that website operators redirect from a URL that has already been forwarded to another URL. These double redirects worsen the server load and increase the loading times of the pages, which in turn has a negative effect on SEO. You should therefore avoid creating chains of your redirects by recording all redirects in an overview. In the event of future changes, you can see at a glance which redirects already exist.
3 thoughts on “A Technical SEO Guide to Redirects – Apptians Blog”
I like your writing style truly enjoying this site.
Thanks for sharing
We have also opened a Classified and Bookmarking website for yoaqu where you can create backlinks for free.