How to redirect a URL in WordPress

How to redirect a URL in WordPress

How to redirect a URL in WordPress

Why would you need to know how to redirect a URL in WordPress? Because at some point you will need them to not lose positioning and improve the user experience. Sooner or later it may happen that you delete a page or article that you had published. It can also happen that you want to change the slug of an entry because you thought it would improve the reading of the URL.

Or even a bad configuration may be generating bad links. It happens more than you imagine. In any of these cases – which are the most common – you will be affected by search engines.

How to redirect a URL in WordPress?

How to redirect a URL in WordPress

In WordPress -and in any website- when we talk about redirection we refer to the fact of diverting the user from one URL to another.

If the user has clicked on a link whose content is no longer there or its URL has changed. If we wish, we can make a small adjustment so that when someone accesses that URL, they are redirected to another that we select.

For example, one of the redirects that I have on my blog is this:

Previous URL: https://abc.com/0000/00/00/a-b-c/

New URL: https://abc.com/a-b-c

At some point, I was wrong in the configuration and that made the URL longer, adding dates in the link.

Why would you need a redirect in WordPress?

What happens when someone clicks on a link and when they get to your page, as that content is no longer there, they come across the old familiar 404 Not Found, also seen as No results found or The page you are looking for does not exist.

The bewilderment for the user who will surely give the back button, leaving your site and going to look elsewhere for what you promised and did not fulfill.

Although the impact on Google is not to worry about, if that link was well located in the results we will lose positions and disappear, but in the process we will cause many frustrations to visitors, generating a negative impact on the reputation of our website.

Of course there are ways to deal with these incidents. One option is to personalize our 404 Error page to provide navigation alternatives: a menu, a search engine, etc.

But in the event that the problem is only the change of the URL, that is, the content continues to exist but no longer with the same address, then we will need to create a redirect. We can also resort to a redirect when we have a similar article, which partly addresses the issue of the deleted entry.

Or take the user to the category of the topic in question. Redirection is a great method to solve these problems.

What types of redirects are there?

Yes, there are different types of redirects. But don’t worry, it’s easier than you think. Google needs to know what type of redirect you are doing to know how to act on that content.

  • 301 redirect: Indicates that the page was permanently moved to a different URL.
  • 302 redirect: We will apply it when our page exists, has been found, but temporarily finds a different address. In other words, your URL has changed somewhat.
  • 303 redirect: In this case, we are redirecting to new content. That is, when entering the previous URL, the user will be taken to another page or entry.
  • 307 redirect: This is also a temporary redirect. But the difference with 302 is that Google understands that in this, the content exists but temporarily changed direction.
    With 307, the search engine understands that it has been redirected to another URL but that the original content no longer exists.

The topic continues and becomes a little more complex, but let’s leave it here since this post aims to be an introduction to acquire the basic knowledge and be able to configure aspects of our site without the need to get into code, server, etc.

How do I do a redirect in WordPress?

A redirect can be done in different ways: through .htaccess, PHP, Javascript, among others. But since we are talking about WordPress, we are going to propose simple methods that do not require technical knowledge. Redirection is perhaps the most popular plugin, very useful for these purposes.

Through its interface, in an intuitive way, you can create as many redirects as you need, with conditions such as: whether or not the user is logged into our site, depending on the browser, by IP, among others. You can also sort them by groups, for a better internal organization. The Yoast SEO plugin in its premium version incorporates a redirect tool.