For traffic, visibility and the creation of a brand image for your business on the internet, it is necessary to create relevant content to obtain SEO juice (see SEO audit phase) . And when the expected results are obtained after a long process, it would be a shame to lose everything in a snap! Thus, when the address of an already well-positioned content must change, for example, certain techniques make it possible to maintain the correct positioning, while associating the content with the new address. The 301 redirect is one of the main techniques used in this context. This redirection indicates that a content or folder is no longer at the original address.

301 redirect: what is it?

A 301 redirect is similar to a change of mailing address. It is also called permanent redirection , for the simple reason that generally, it is set up permanently. It is therefore the opposite of the 302 redirect, which is temporary. In rare cases, the 301 redirect indicates that content has been removed from the URL provided. But in most cases it indicates that the content has been moved to another URL. The use of the 301 redirect is essential when reconfiguring or completely or partially redesigning the structure of a website. It’s a simple way to respond to the site visitor’s request and improve their user experience.

Permanent redirection helps avoid lost content and 404 errors that cause you to lose visitors. It is very useful in the field of e-commerce in particular, in the sense that it allows not to delete the page of a permanently unavailable product. Thus, rather than deleting the page, the ideal would be to redirect visitors to a page close to the one sought. This trick makes it possible to offer the prospect products similar to those they are looking for and which might interest them.

See also  The Guide to Redirects for SEO 2022

The 301 redirect is aimed at Internet users and search engine crawlers . When the permanent redirection is created via the HTML 301 code, the browser redirects the Internet user to the new web page. The user does not even realize that there has been a change. Only if he takes the trouble to observe the contents of the address bar of the browser will he notice the presence of a URL different from the one he had entered.

For their part, search engine algorithms are notified by the 301 redirect that the indexed page has changed its URL . Thus, they indicate the new address in the search results. In most cases, the webmaster is responsible for inserting the HTML 301 code in the .htaccess file of the FTP server. Additionally, hard redirect codes can also be handled by Apache with the mod_rewrite or mod_alias modules.

301 redirect: what is it for?

The 301 redirect is a great way to control and process a site’s SEO juice. Thus it allows to avoid the massive loss of internet traffic . Although useful, the redirection should not be done in an anarchic way, otherwise, it would disturb Google‘s indexing robots. However, it is sometimes essential, such as when switching from a free host to a domain name in .com, .fr, etc.

When properly used, the 301 code serves to avoid duplication of content . As an entrepreneur present on the web, you are certainly interested in the position of your pages among the search results. Then you know that Google‘s algorithms hate duplicate content. The 301 redirect makes it possible to find a solution for two pages (one new and one old), with almost identical content. It is used to send the user to the new URL even when entering the old one.

See also  The Importance of Publishing a Newsletter for your Business

Moreover, when there is a site redesign, the configuration of the site is modified, which often causes the loss of SEO juice, due to web pages having lost their quality. Thanks to the 301 redirect, we then allow Google robots to establish the correspondence between the old and the new web addresses . Thus, the Internet user does not risk coming across 404 pages that do not contain the article or file sought. Similarly, in the event of a change of domain name, the 301 redirection makes it possible to converge the contents of the old domain name towards the new one . The same applies when buying a domain.

301 redirect in application

Creating a full 301 redirect is key to not losing traffic when changing a site’s structure. It is carried out through several methods, the most classic of which go through PHP and the .htaccess file.

301 redirect in PHP

To create a 301 redirect in PHP, you have to go through the source code of the page concerned. You will then need to enter the following lines of code at the header level:

header("Status: 301 Moved Permanently", false, 301);
header("Location: http://www.example.com/nouvelle-page.htm");

exit();

The first line of code tells the server that it’s a 301 redirect . As for the second line, it indicates the new address to which the Internet user will be redirected. Regarding the third and last line, it is used to complete the PHP script.

Make 301 redirect via .htaccess file

Using the .htaccess file to create redirects keeps all redirects in one place . This way of proceeding is useful for creating redirection rules, thanks to which it is notably possible to redirect several pages in a single line of code.

See also  SEO Tutorial: The 12 types of meta tags and their impact on SEO 2022

To redirect a page, the command to use is the following:

RedirectPermanent /repertoire/page-source.html
http://www.example.com/directory/target-page.html

Moreover, to redirect a site from the HTTP protocol to HTTPS, the HTTP version should no longer be available, in order to avoid duplicate content. Rewriting rules are then imposed, and commands such as these are used:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80

RewriteCond %{REQUEST_URI} !

RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

It should be noted that the commands differ depending on whether it is a redirection of a complete directory, a redirection from one site to another, a redirection with a change of extension, a redirection to force the www, etc. In all cases, handling the .htaccess file must be done with care, to avoid ending up with a 500 error (error during connection to the server, site inaccessible).

5/5 - (1 vote)