0
votes

My post URL structure is http://example.com/slug and the category URL is http://example.com/category/category-name.

Currently, my custom structure is /%postname%/ and the category base is blank.

I would like to change the category URL to http://example.com/category-name. How do I go about this?

I tried with htaccess but got 404 error:

RewriteRule ^category/(.+)$ http://www.yourwebsite.com/$1 [R=301,L]
1

1 Answers

0
votes

You're receiving a 404 because you're sending users from http://example.com/category/category-name to http://example.com/category-name, which doesn't actually exist as a page, yet.

The RewriteRule is a redirect, rather than framing the URL.

From the sounds of things, you actually have a category base set within Wordpress (hence the "category/" before the category-name), which can be removed by going to "Settings" -> "Permalinks" -> "Category base" in the Wordpress panel.

In the event you're also using YoastSEO, you may wish to reference this documentation from Yoast.