WordPress: Remove ‘category’ base from URL and add category to post URL

0
94

In wordpress you usually group your posts in categorys. And wordpress will automatically generate catagory-archives which display only the posts of a certain category.

The URL-Structure for categories is:
www.yourdomain.com/category/categoryname
The hardcoded word category is called the Url-Base.

The Url for a post is usually:
www.yourdomain.com/postname

This is bad, as search engines will have diffuculties perceiving posts as children of category pages.

A better URL Structur for wordpress

wordpress URL structure without category base
nice URL-Structure for wordpress without category base

A better way to structure your Urls would be to display your categorys without an Url-Base:

www.yourdomain.com/categoryname

And to add the primary categoryname to Urls of your posts:

www.yourdomain.com/categoryname/postname

How to remove the URL-Base in WordPress

The easiest way to remove the Url-Base in wordpress ist via the plugin Yoast SEO, which I use for every website anyway.

remove category base wordpress
Step 2: Configuring Yoast SEO to remove category base

After installing and activating the plugin, go to the Dashboard of “Yoast SEO” and change to the “Features”-Tab.

Enable the option:
The advanced settings include site-wide settings for your titles and meta descriptions, social metadata, sitemaps and much more.

remove category base wordpress
Step 2: Configuring Yoast SEO to remove category base

There should be new section called “Advanced”. In that section open the tab “Permalinks” and switch this option to “Remove”:
Strip the category base (usually /category/) from the category URL.

You can enlarge the pictures by clicking of them to see where to find the options.

How to add the categoryname to the URL in a wordpress post

The last step will be to add the categoryname to the Url of our posts.

Wordpres Post URL: add primary category
How to add the primary category to a wordpress post URL

This can be done in the “Permalinks”-Section under “Settings”. Just choose “Custom Structure” and add this at the end:
/%category%/%postname%

When to change the URL-Structure of your page

You should do this when creating a new page as this could be relevant to get a better position in search engines.

You should not do this on pages that are already fully indexed, as google won’t be able to find your pages at the old Urls and will have to index them again.
Some or all of your posts and archive pages might loose their current ranking. Only do this if you know how to redirect from the old url structure to the new one.

If you need help with anything, just ask about it in the comments.

LEAVE A REPLY

Please enter your comment!
Please enter your name here