How to remove or delete /category/ from WordPress URL

0

Sometimes you install a theme on WordPress and end up with the annoying /category/ in your url. There are two ways to get ride of the /category/ so you don’t have this going on:
http://mywebsite.com/category/category-name/

The /category/ does serve a purpose–it is to prevent you from creating a page with the same name as your category–thus causing a conflict. So if you make a change make sure not to create conflict–if you don’t you’ll end up with a number on the end of your category or page.

Two approaches to solving this:
First:
1.Go to Settings > Permalinks and select Custom and enter: /%category%/%postname%/
2.Next set your Category Base to: /.
Once saved,you’ll see your URL changed to this format:
http://mywebsite.com/category-name/

Second:
Add the following code to your .htaccess file.

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

I prefer the first step. However, if your site has been around for a while your urls for categories won’t automatically redirect. You’ll need to set that up in your .htaccess file for a 301 redirect or download and use the plugin Redirection.

LEAVE A REPLY