+0 votes
in Tutorials and Guides by (1.5m points)

How to remove category from the category URL in WordPress

1 Answer

+1 votes
by (725k points)
 
Best answer

In this article we will show how to remove category from the category URL in WordPress . This was previously achieved very easily with the Yoast WordPress SEO plugin , but since it was updated to version 1.5 we no longer have this option so I had to find an alternative method.

image

Why remove "category" from the category URL?

Many of you will be asking the question of why we should eliminate the word "category" from the category URLs and the reason why this is done is to "improve" SEO. I put in quotes to improve because it is suspected that the impact on SEO is practically nil (hence in Yoast's plugin this option was eliminated). Even so, many people prefer to remove "category" from the URLs for something as simple as aesthetic and that the URLs are shorter and easier to remember.

One thing that is true, is that if we have a WordPress blog in Spanish , having the word "category" is a bit ugly, so it is advisable to configure from the beginning in the Ajustes → Enalces permanentes menu Ajustes → Enalces permanentes the "base category" and the "base tag" to at least use words in Spanish.

image

Yes, I know, in Vozidea I have not followed my own advice because these are things that are learned along the way and when Vozidea started, I did not know this topic, so I share what I learned in this article.

The other option will be to eliminate the word category that we will see next how to do it.

How to remove category from the category URL in WordPress

This is something we can achieve in several ways and we will see one by one to analyze them and see which is the most recommended option.

Use the .htaccess file

In this method, what we will do will be a permanent redirection of the URL with the word "category" to the URL that does not have it. It is clear that this method from my point of view is not recommended but I will still show how it would be done.
We have to edit the .htaccess file found in the folder of our WordPress blog and add the line:
RewriteRule ^category/(.+)$ http://www.tublog.com/$1 [R=301,L]

We save the changes and go.

Use a plugin

I know two plugins to remove the base category from the URLs. Both plugins are simple to install and do not require configuration, once installed and activated we already have them working. The plugins among which you can choose are:

In my opinion, using one of these two plugins is the best option we have.

Using the point trick

There is a third option that is to configure from the menu Ajustes → Enalces permanentes the "base category" using a period .

image

This trick works today and seems the cleanest since we do not need to install plugins, edit .htaccess or anything. It has the disadvantage that perhaps in some future WordPress update it will stop working , although for the moment it works well.

Things to keep in mind when removing category from the category URL

Eliminating the base category is good but it has a number of drawbacks that must be taken into account to perform the necessary checks.

The first and most obvious, is that if we have an entry entitled "Cheap VPS servers" and its URL is http://www.web.com/servidores-vps-baratos we will not be able to create a category that uses the same slug, that is, we could not create the category http://www.web.com/servidores-vps-baratos , because the URL would be the same and we would have conflicts.

The solution to this would be to edit the links or slug so that they were different.

Another thing to keep in mind is if we have plugins that use the URLs of the categories as they can give us problems. An example would be a plugin that creates the sitemap of our website, we must verify that it uses the correct URLs for the categories.

As you can see there are several things that must be taken into account and it is difficult to list them all, but with the previous examples you get an idea of "‹"‹what things to check.

I hope you liked the article and if you liked or helped, it would be nice to share it.


Most popular questions within the last 20 days

...