URL Redirection: Which One to Choose and How to Do It?

URL Redirection: Which One to Choose and How to Do It?

by Mohd Shahrukh August 04, 2021

While URL redirection is very useful, it is sometimes difficult to achieve. In this article, I will tell you everything about redirects: when to use them? Why? And above all, which one to use and how?

Redirection is used to automatically redirect an Internet user arriving on a URL A (or web page A) to a URL B (or web page B) without him noticing it.
While this practice is beneficial, it is sometimes difficult to achieve. There are indeed several types of URL redirection. However, you should choose the right one, the one adapted to your situation, to not degrade the user experience or your natural referencing.
In this article, I will tell you all about URL redirects: when to use them? Why? And above all, which one to use and how?

When to use URL redirection?

There are many situations that URL forwarding can be used for that you will undoubtedly be faced with someday.

Among the most common are:

Change of domain name

When your domain name is too long or is no longer representative of your activity, you are often forced to change it.
URL redirection is necessary to redirect Internet users who come across your old site to your new site.

Access to the same web page via different URLs

When the same content is accessible through different URLs, it creates duplicate content, which is terrible for your SEO. Unfortunately, this is often the case for the home page of a site.
Let’s say that your home page can be visited via three URLs: URL A, URL B and URL C. Thanks to a redirect, you can, for example, redirect all users who arrive on URL B and C to URL A. This tells Google which page should be indexed and gives Google more authority.

Changing URLs

This can happen when you update your site and touch the structure of your URLs.
Take the example of an e-commerce site: your product entitled “cup of tea” is accessible via the following URL: www.mysite.com/categories/tableware/cup-of-tea.
If you decide to remove the “categorie” directory to simplify and reduce the length of your URLs, your product will then be accessible via www.mysite.com/vaisselle/tasse-de-the.
If you do not create a redirect, Internet users will likely encounter a 404 error while clicking on the old URL. This can happen if a third party site linked your product before the change made to your URLs.

Access to a multilingual site

If you do business internationally and have your site in different languages, you can create URL redirects. These make it possible to display the correct version of the content to Internet users according to their geographical position.
URL redirects can also be implemented if you merge two websites, if you delete a web page or if you no longer want to use the “www” (or vice versa).

The main types of URL redirection

There are two types of URL redirects:

  1. Client-side redirection
  2. Server-side redirection

The latter is executed by a server as its name suggests, while the former is performed directly by the “client”, often the user’s browser.

Server-side redirects

These are the most common.

For an Internet user to be redirected to a URL, an HTTP request is made to the webserver. The latter then delivers an HTTP status code that specifies the redirection to be carried out.
The status code corresponds to the name of the redirects. These can be temporary or permanent.

HTTP status code Redirection Temporary or permanent
301 301 redirect Permanent
302 302 redirect Temporary
307 307 redirect Temporary

Client-side redirects

If these redirects are used less, it is mainly because they have several disadvantages in terms of SEO.
To name just one, search engines don’t always notice client-side redirects, and when they do, the authority of the old web page is not transferred to the new one.
Still, it’s good to know about the two types of client-side redirects:

  • The Meta refresh tells the browser to refresh the web page or redirect the user to another URL after an unavoidable delay. You have undoubtedly encountered this situation after making an online payment.
  • JavaScript redirection: it asks the browser, via JavaScript code, to load another URL

Which URL redirection to choose?

Redirection 301

It is undoubtedly the most used URL redirection.

You need to set it up to permanently redirect users who arrive on a page that has been deleted or moved or for which the permalink structure has been changed.

Code 301 tells Google several things:

  • The page in question is no longer available at this URL
  • The page should no longer be indexed
  • The link juice from the old page should be transferred to the new one

So you understand that a 301 redirect allows you to keep the authority of your old page: all your SEO efforts are maintained.

Warning
Before setting up such a redirect, ensure that your old URL will no longer be used because you will hardly be able to go back.
To set up a redirect between two pages, open your .htaccess file and insert the following code: RedirectPermanent http”//www.old-url.html http://new-url.html.

Alternatively, you can insert the following PHP code in the HTML source code of the page to redirect (<head> section):
<?php
header(“Status: 301 Moved Permanently”, false, 301);
header(“Location: http://www.example.com/another-page.php”);
exit();
?>

For more complex cases, call a qualified professional. Editing the .htaccess file should not be taken lightly because if an error occurs, it can cause damage to your site.

Redirection 302

This temporary redirect indicates that the content was found but is currently located at a different URL. You can, therefore, temporarily redirect visitors to this other web page.

Did you know?
Initially, the 302 redirects did not involve any transfer of authority, which is why it is used so little, but today the situation seems to have changed.
You can use it when the content of a URL A has been temporarily moved to URL B or when you want to redirect your visitors to the correct language version of your site.

As with the 301 redirects, you can perform a 302 redirect through the page’s source code to redirect or directly from the .htaccess file.

In the first case, insert the following PHP code:
<?php
header(“Location: http://www.example.com/another-page.php”);
exit();
?>
In the .htaccess file, insert Redirect http”//example.html http://www.example.com/another-page.html to make a redirection between two pages.

Redirection 307

While the 302 redirect is more ambiguous, the 307 redirect indicates that URL A has been moved for a short time.
This redirection is to be used if your site is under maintenance, for example.
Since this is a temporary redirect, search engines ignore the authority of the old URL.

Redirects should be used in specific cases and sparingly. So that they are relevant and do not harm your SEO, take the time to analyze your situation to choose the proper redirect.

Social Shares

Subscribe for FREE Digital Marketing Newsletter!

Subscribers get the best curated content for you

Leave a Comment

Your email address will not be published. Required fields are marked *