Change Category Slug within WordPress
When I first started this blog, I set the category "slug" to "sugar." Why sugar? Because a lot of a good thing is candy; thus, a bunch of MooTools tutorials is as sweet as sugar. While I get a giggle out of calling my categories sugar, Google doesn't find it nearly as funny, nor does Yahoo or Bing. In an effort to increase my SEO, I wanted to change my category slug to "tutorials." That's where the awesome Redirection plugin and a simple regular expression comes into place.
Changing the Slug
You can very easily change the category slug within WordPress's admin panel by navigating to Settings >> Permalinks:
I changed the slug from "sugar" to "tutorials."
So why do we need the Redirection plugin? Because search engines like Google and users who have bookmarked your site will try to reach the old address. Thus, we need an appropriate redirect to push them to the new address. Not only do we need a redirection plugin but we need it to be reliable. I've been using Redirection for years so I knew this would be the best route.
While Redirection allows you to make a simple URL to URL redirection, I needed something a bit more powerful since almost anything could be after "/sugar/" in the URL. What I did was use Redirection's regular expression capabilities to create a wildcard search on the URL to redirect all "/sugar/" URLs to "/tutorials/" URLS:
And there I have it; all category URLs are redirected as they should be! The
(*) in the source URL grabs the text after "/sugar/" in the URL and the
$1 in the Target URL places that text after the new category slug!
The Redirection plugin for WordPress is outstanding. As I mentioned above, I've used it for years, have hundreds of redirections in place, and it's always been one of my most trusted plugins. Thanks to John Godley for his great plugin!