Skip to content

301 redirects – the most popular types

On the Internet, every thing has its place, defined by its URL. If for any reason it changes, it creates a number of difficulties – both for Google crawlers, which are responsible for positioning the page, and for users who are looking for specific content. However, there is a way – the 301 redirect is the equivalent of changing the correspondence address in the non-virtual world. Check how it works and what types of 301 redirects can be used.

What is a 301 redirect?

A 301 redirect (Moved permanently) is a mechanism that indicates that a given page has been moved to another address. It works automatically – that is, it does not display information about the “move”, but immediately directs to the correct page under the new URL path. Thanks to this, e.g. search engine robots and Internet users do not have to wander in search of specific content.

There are several types of redirects, but 301 is the most popular of them. It means a permanent move, i.e. a permanent change of the website address. This solution is very convenient from the user’s point of view, and at the same time extremely important for SEO. Thanks to the redirection, the website does not lose its position or power and can continue to work on it.

When is a 301 redirect used? The most popular types

A 301 redirect might be necessary for a variety of reasons. It is (usually) done in a .htacces file – just use the appropriate code. There are several most popular types of such an activity. Examples and the codes needed to make them can be found below.

301 redirects from the address from “www” to “without www”
Page addresses can be with or without “www” at the beginning. If this issue is not sorted out, it can create chaos and the traffic will be broken down into two separate addresses, which is extremely bad for SEO.

Therefore, in such cases, the 301 redirect is most often used, which allows you to choose the preferred form of saving the website address. This makes the user go to the target page, regardless of whether he types in the browser bar, for example, “www.yoursite.com” or “yoursite.com”. This solution has a positive effect on optimization and determines the user’s comfort.

Sample code:
RewriteCond% {HTTP_HOST} ^ www.yoursite.com $
RewriteRule (. *) $ Http://yoursite.com/$1 [R = 301, L]

Domain change
Changing the domain name is a relatively common procedure. In this case, you should take care of redirection so that users can easily find the new address, and Google robots do not consider the transferred content duplicate content, which is highly inadvisable in terms of SEO.

It is extremely important to ensure that the 301 redirect concerns not only the home page, but also other tabs. The best solution is to use them to set direct paths to new addresses for each subpage. It is worth trying, for example, so as not to discourage users by meeting the wall, i.e. entering a website that no longer exists. It is also the only way to move your site without losing traffic.

It’s best to implement a 301 redirect before migrating data to a new address. This allows crawlers to correctly read your actions: as moving your site rather than creating a completely new one with duplicate content.

Sample code:
RewriteCond% {HTTP_HOST} ^ yoursite.com $
RewriteRule (. *) $ Http://yoursite.com/$1 [R = 301, L]

Change from HTTP to HTTPS
Using the SSL protocol involves changing the address from HTTP to HTTPS. Then you should also redirect.

Sample code:
RewriteCond% {HTTPS}! = On
RewriteRule (. *) Https: //% {HTTP_HOST} / $ 1 [R = 301, L]

A slash (“/”) at the end of the address
The same address that differs only by the slash at the end (for example, “www.yoursite.com” and “www.yoursite.com/”) are two separate pages for Google. Failure to redirect in this respect is a very common mistake, which causes the algorithm to read your content as duplicate content, and thus getting a high position in the search results is basically impossible.

Sample code:
RewriteCond% {REQUEST_FILENAME}! -D
RewriteRule ^ (. *) / $ / $ 1 [L, R = 301]

Wildcard redirection
The wildcard feature helps you easily create new subdomains. However, in practice it also means that entering any string of characters before the address of your website will display its content, creating a copy of it. Sometimes Google robots index such pages, creating incredible chaos. Then, the search results may show several (or even several dozen!) Versions of the same address, e.g. for example www.yoursite.com also www.tyoursite.com, ww.yoursite.com or e.g. yoursite.yoursite.com . It is very dangerous and may result in penalties from Google. Solution? A 301 redirect that will take users and Google bots from each subdomain to the home page.

RewriteCond% {HTTP_HOST} ^ (. +). Yoursite.com $
RewriteRule (. *) $ Http://tyoursite.com/$1 [R = 301, L]

Other types of redirects

Let us remind you that the 301 redirect is used only in the case of a permanent change of the website address. However, there are also many other possibilities of transferring Internet users to another address and sending an appropriate message to the search engine robots. Other types of redirects available are:

302 (Found) – temporary, allowing the content to be moved to another address and then returned to the original source;
303 (See Other) – used with forms sending data using the HTTP POST method, enabling redirection to a specific address in response to this form;
304 (Not Modified) – informs the browser that the data in its memory is up-to-date, has not changed, so it does not have to be downloaded from the source;
305 (Use Proxy) – allows you to use a given resource only when using a specific Proxy server, displays a message with the server address;
307 (Temporary Redirect) – temporary redirection, does not allow to change the request method from POST to GET.

What to remember when using 301 and other redirects?

It is worth remembering that redirects are not only beneficial for users, but also facilitate the work of Google robots and help ensure proper indexing of the page. So they have a positive effect on both UX and SEO. Using them skillfully, you can “painlessly” move pages to new addresses, and also allows you to carry out many other activities without compromising the position of the site.

However, be careful when using redirects of different types. Using too many commands may result in the formation of a loop, and the resulting error 310 – Too many redirects, which prevents you from hitting a specific page.

Published inOnline ParaphrasingRedirectsRephrase OnlineSpecialWebsite Positioning