301 redirects – .com

Quick tutorial in which we see how to do 301 redirects, for those URLs that we have permanently moved or migrated.

permanent redirects

A redirect is an “instruction” that we give to our server (the hosting where we have the web) for a specific URL to redirect to another. There are several types of redirects, and I cover all of them in episode 362. Podcast Redirects.

But today we will talk about the 301 redirect, which is also known as “permanent”. This type of redirect can be useful in many cases, let’s give an example:

  • We change a content post, page, product, etc.
  • We change domain (for example, from webantigua.com to webnueva.com).
  • We change a part of the web (for example from blog.domain.com to domain.com/blog).
  • we remove content on our website that will no longer be there.
  • We remove the “www” from our website (or we add them)

As you can see, in all cases we are talking about the same thing: moving content permanently. Changes that (in principle) they should be fixed, forever.

If we did not do these redirects, we would have two problems: The first is that all the links, both ours and from other websites that we have accumulated, will automatically give a , since that content does not exist.

It is true that we can, but in 90% of cases it is best to do a redirect, especially if we are migrating our website. In that case, listen to episode 116. How to migrate a website without losing position to do it right.

How to do them?

Technically it doesn’t have any difficulty, we only have to edit the .htacces file of our server with a , and that’s it. It is a very peculiar file, because it does not have an extension, and on top of that it starts with a period: “.htaccess“.

See also  Add WooCommerce customers to Mailchimp - .com

In the world of servers, a point before the file name means that it is “hidden”, so our FTP program may not show it. In this case, you will have to activate “View hidden files” in the preference settings.

So, we will open it with anyone, and at the end of everything we will add this line:

  • Redirect 301 /relative-old-url/ http://domain.com/absolute-new-url

be careful with this, because if we don’t do it EXACTLY as it should, the whole web is going to give us a . If it happens to you, don’t worry, because you just have to undo the changes, save, and that’s it.

Ok, so let’s look at the instruction again:

  • Redirect 301 /relative-old-url/ http://domain.com/url-new-absolute

Let’s note that it has three different parts that I have marked by colors. They must be separated by a space. Only one. Neither a tab, nor two spaces, nor anything that is not a single space. If we do not do it like this, error 500. Let’s see each part:

  • Redirect 301: This refers to the type of redirection. By telling it that it is 301, we are telling it that it is permanent.
  • /relative-old-url/: This URL is the ancient, that we will no longer use and that we want that if someone visits it, they are immediately redirected to the new one. Let’s establish that it should be relative. That means that you should NOT put the domain or the “http://” or anything like that. So if it were http://web.com/contact/, the relative URL would simply be /contact/.
  • http://domain.com/url-new-absolute: And finally we have the URL new, that is, the destination, to which we will redirect the visitor. Let us note that, contrary to the other, this is absolute. In other words, it is indicated with the domain, protocol, and everything that is needed. For example http://webnueva.com/contacto/.
See also  Course to publish a book on Amazon - .com

And that’s it. Simple as that. Let’s see some examples:

  • Redirect 301 /old-post/ http://web.com/new-post/
  • Redirect 301 /url-maybe-too-long/ http://web.com/url-short
  • Redirect 301 /kfjenjf434?hjd=12/ http://web.com/url-facil

As you can see, it doesn’t have any difficulties. We only have to place the redirection, the origin and the destination, and that’s it.

Strengths

Without a doubt, the main advantage of doing a 301 redirect is that we do not have to modify any of the old links, either on our website or on third-party websites, since all users will be redirected automatically.

But there is also the issue of SEO: A 301 redirect passes all the SEO “power”, all the Google juice, and ultimately all the positioning to the new URL.

So, after a few weeks of having redirected that URL, we will see how the old one disappears in Google to make way for the new one, which will have positioned itself in its place.

problems or weaknesses

The main problem with doing it this way is that we have to go URL by URL, one by one! If, for example, we have to modify 3,000 URLs, we must write 3,000 lines in the .htaccess file

As you will surely imagine, this is not very good, since an excessively large file may remain. In those cases there are other logical instructions that may be a more optimal choice, and that we will see in other tutorials.

So, it is not recommended to have thousands of 301 redirects because it will take us a long time to do it, and it can also affect the server load time.

See also  Create a landing page with GeneratePress - .com

Summary and conclusion

301 redirects are for shape redirect permanent to visitors and search engines from one URL to another. They only require adding a single line for each redirected URL in the .htaccess file located in the root of the web.

In addition to redirecting traffic, it also “passes” the positioning and Google juice that the source URL may have, to prevent it from being de-indexed by Google.

If you want to know more about all these little things, I advise you to take a look at the , more than 6044 at your disposal 🙂

Loading Facebook Comments ...
Loading Disqus Comments ...