Wordpress Tips:
How to remove the "category" suffix
in the category permalinks

By Joan Piedra
Inspired by Category Base Removal Plugin

Step #1: Control Panel

  1. Login into your Control Panel
  2. Open the Permalinks section in Settings menu
  3. Choose Custom Structure and write the following /%category%/%postname%
  4. Leave the Category base field empty
  5. Save your changes

Step #2: Editing the functions.php

Add the following in your functions.php inside your current theme.

function kill_category_base ($string) {
	$string = str_replace('category/', '', $string);
	return $string;
}
add_filter('category_link', 'kill_category_base');

Step #3: Editing the .htaccess

Change the following lines in your current .htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

For the following

# remove the category suffix - by Joan Piedra
# http://joanpiedra.com/wordpress/remove-category-suffix-permalink
RewriteRule ^(feed|comments)/(rss|feed)$ index.php/$1/$2 [L]  # filter rss feeds
RewriteRule ^([^/.]+)/(page/([0-9]+)|feed)$ index.php/category/$1/$2 [L]  # redirect category pages and feeds

# redirect everything else to wordpress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.