A redirect is a redirection of a user within the site from one URL to another. The principle of redirects is similar to phone call forwarding. For example, if one employee of a company you call is busy, your call will be automatically redirected to another available specialist. Or, if you lost your smartphone with the main SIM card, and you need to redirect calls from it to another number that you have access to. A redirect works in a similar way, only with website URLs instead of phone numbers.
Redirects are set in the following main cases:
- Different URL Versions: Redirection is needed so that the user sees the same content regardless of how they write the URL: with the WWW prefix or without, with a slash at the end or without (/), etc.
- Moving to Another Domain: If the domain name has changed, it’s important to preserve the traffic going to the old site, as well as all SEO work.
- Appearance of Subdomains: For example, if you have a product catalog on the subdomain something.site.ru, then redirects will be needed from all pages of the old section site.ru/something (where these products were previously located) to the corresponding pages of the subdomain.
- Change in Site Structure: For instance, previously there was a separate “Toys” section (site.ru/igrushki), but after restructuring, it became part of a larger “For Children” section. In this case, all pages of the “Toys” subsection will have a new level of nesting (site.ru/kids/toys), and redirects will have to be set from the old URLs to the new ones.
- CMS Change: Engines often have different algorithms for generating web pages. For example, if previously the bicycle catalog was called site.ru/product, then after changing the CMS, it became site.ru/catalog. Therefore, redirects will need to be set for all subcategory and product pages.
- Redirection to Mobile Version: Some sites still have separate mobile versions (address notation — m.site.ru), not adaptive ones, where the URL remains unchanged, and the content adapts to the smartphone. Setting up a redirect will help the browser redirect the user to the version corresponding to their device.
- Deleting Pages: Often, a page becomes irrelevant. For example, if a promotion on a product has ended or if a service is no longer offered. However, such pages usually already have their own link weight, for example, if they were promoted in social networks or links to them were published in a blog. In such cases, it would be reasonable to set redirects from the old pages to other, but contextually appropriate ones. It is important that the new page contains information about the promotion or service from the old page.
How Redirects Work
The general logic of redirects is as follows:
- You specify the addresses of the donor page (from where to redirect) and the acceptor page (where to redirect). Often, such relationships are prescribed not individually for pages, but for entire groups.
- The user enters the address of the page in the address bar, for example, site.ru/oldpage.
- The browser contacts the site’s server and requests the page site.ru/oldpage.
- The server begins to apply all the rules prescribed in its settings and gradually reaches the rule “redirect visitors from the page site.ru/oldpage to the page site.ru/newpage.” If the rule was set before the content was loaded, the user won’t even notice that the URL was changed.
- The user sees the content of the acceptor page — site.ru/newpage.
Types of Redirects
The main types of redirects that are most commonly used and solve most tasks are 301, 302, 303, and 307. Let’s take a closer look at each.
301 Redirect
Its designation is moved permanently, meaning “moved forever.” This is a permanent redirection from one page to another, with the donor no longer existing. The search engine will remove the old page from the search results and show the new one instead. The 301 redirect is very often used for most of the purposes we talked about above: merging mirrors with/without WWW, moving to a new domain when all URLs of the old site are completely and permanently replaced by new ones, changing the CMS to a new one, removing duplicate pages, etc.
The donor is removed from the index, but not just like that, but with “inheritance”: its authority, link mass, and traffic indicators are transferred to the acceptor, and then it is indexed.
If you do not set a 301 redirect from the old to the new pages, the search engine will consider the donor and acceptor as different sites with all the ensuing consequences. For example, it will consider the acceptor a duplicate and lower it in the search results.
Cases where a 301 redirect is not suitable:
- For temporary redirection, for example, temporary replacement of seasonal goods that are no longer relevant with others, or temporary replacement of pages with promotions;
- In cases where it is important to continuously track traffic metrics on the substituted page, for example, when there is advertising with geotargeting, targeting by devices, referral campaigns;
- When conducting A/B testing of the sought-after page.
302 Redirect
Its name is moved temporarily, meaning “moved temporarily.” It is set when it is not necessary to delete the donor page, but only to tell search engines to “temporarily ignore” it. The new page is not indexed and does not receive the indicators of the old page. The donor is simply temporarily considered non-existent but retains all its indicators. The old URL is visible in search engines for six months after the changes are made, and if the 302 redirect lasts longer, the new page appears in the search results. This redirect is used if technical work is temporarily being carried out on the donor page, for example, redesigning the design or uploading content. As soon as the work is finished, the page will “return to service,” but for now, its replacement is shown.
Cases where a 302 redirect is not suitable: in essence, only one – if you delete the original page forever or do not want it to be visible in search engines anymore.
303 Redirect: It is called see other – “look at something else.” It is somewhat similar to both 301 and 302, but with a significant difference. The 303 does not say, “I completely replaced the old page with a new one,” but reports, “something similar is on another page, here, take a look.” That is, the content match does not have to be complete. However, this function is rarely used. More often, it is used for pages that should not be updated multiple times, such as the payment page.
307 Redirect
This is also a command for temporary redirection, like the 302. However, it has several technical differences:
- it is newer and more accurate, created for one of the latest versions of HTTP;
- it works better than 302 with redirection by the POST method;
- it does not work in all browsers, which explains why it is not used as often as 302.
There are other types of redirects, such as 304-306, but they are either outdated or not supported by all browsers, or are almost complete analogs of common redirects. They are used very rarely.
What is better to do with a dropped site: set up a 301 redirect or place the site and put a link?
This question arises in a situation when you manage to get a trustworthy domain with backlinks, which can be used for your projects. To answer, you need to ask yourself how important the stability of your main sites, constant growth and dynamics are to you, and how concerned you are about sanctions from search engines. If all this does not bother you much and you just want to conduct an experiment, then it is worth trying either
If you are responsible for the quality of promotion and want to benefit from a domain drop, we recommend trying a 301 redirect. The strategy is simple: set up 2-3 redirects from the drop domain to one site. It’s desirable for the theme and content of the drop page and your site to be similar. For instance, it’s better not to redirect a domain about insurance to a gaming site. Google may notice such a significant divergence in themes and may not only stop considering the redirect but could also impose a filter.
In case of a successful redirect, your main domain will gain some link weight, and possibly a significant increase in traffic.
Sanctions for Incorrect Redirect
Google can penalize sites for improper redirection, as it often perceives redirects as content manipulation. A ‘legal’ redirect for Google is the redirection from old pages to new ones when changing the site’s address. Illegal hidden redirection, for example, includes redirection to pages that are closed for search robot visits. The punishment can be the removal of the URL from the search engine’s index and, consequently, a drop in traffic to the page. Moreover, sanctions can also be imposed for mobile redirects when mobile users are directed to a completely different web page.
If a site is under penalties, it’s likely that even moving to a different domain won’t help. Google considers that the site itself violates the search engine’s requirements. Therefore, if possible, it’s better not to use a 301 redirect when moving a site under sanctions.
How to Make Redirects Effective
The simplest way of creating a redirect — just setting it in the administrator console — is often incorrect.
A good method of implementation is through the .htaccess configuration file.
Here’s how this method works:
- Find .htaccess in the root folder of the site via the file manager or CMS control panel. Some engines allow opening and editing files from the administrator panel (e.g., ‘Bitrix’). Alternatively, you can download the file to your computer and edit it there using ‘Notepad’ or Notepad++.
Before editing the existing .htaccess file, make a backup copy to always be able to revert to the old settings.
If there is no .htaccess file, it is likely not created. Then you need to create it manually:- Create a new .txt file.
- Rename it by removing the name and adding the extension to get .htaccess.
- On macOS, you need to assign any name to the file, otherwise, it will be invisible. The name can be deleted after uploading to the server.
- Edit (or fill in anew) the .htaccess file using special code. Below we will show examples of this code for the most common redirect situations, but for now, it’s important to say that there are two main modules for such commands.
mod_rewrite — easily recognizable by the word Rewrite in directives (e.g., the directive RewriteEngine On ‘activates’ the redirect mechanism, so it is located at the very beginning). It is used most often and is suitable for setting redirects for entire groups of pages.
mod_alias — another set of directives for setting up simple individual redirects, for example, when one page needs to be replaced by another, leaving the rest untouched. The most recognizable commands from it are Redirect or RedirectMatch.
Example of mod_rewrite code for redirecting to another domain:
perl
RewriteEngine On
RewriteCond %{HTTP_HOST} old-site.ru
RewriteRule (.*) http://new-site.ru/$1 [R=301,L]
Example code for redirecting from WWW to non-WWW version:
ruby
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.my-site.ru$ [NC]
RewriteRule ^(.*)$ http://my-site.ru/$1 [R=301,L]
Example code for redirecting from HTTP to HTTPS:
perl
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
- If you don’t want to write .htaccess manually, you can use special service generators such as IKSWEB, Htaccess.ru, etc.
- Test the settings. After changing the .htaccess file, you need to check if all the rules written in it work correctly. If something is wrong, check the syntax and order of the rules. All rules in .htaccess must be specified in the order in which they will be executed. If two commands contradict each other, the one higher up will be executed.
- Add .htaccess to Google Search Console to track statuses.
Be especially careful with redirects when moving a site to another domain or CMS, as well as during a very large-scale change in structure. In these cases, many redirects need to be set, so there is a high chance of making a mistake. When setting a redirect from a drop, it’s important not to overdo it (2-3 redirects per site), and also to ensure that the themes of the drop and the main domain either intersect or are close, or completely coincide.
Don’t abuse redirects, treat them as a last resort in scanning settings. If you delete a product page, you shouldn’t redirect to the category — limit it to a 410 redirect. Use 301 redirects when moving a site, changing URL structure, preserving link mass, but no more.