views:

42

answers:

3

I have a url like:

http://skepticalgamer.com/category/slam-the-controller

I'd like to strip out "category" from the URL. So I'd want:

http://skepticalgamer.com/slam-the-controller

to act as if it were the original URL above. Is that something that can be done with mod_rewrite?

+2  A: 

Yes, you could do this with mod_rewrite by doing something like this:

RewriteRule ^slam-the-controller$ category/slam-the-controller

This will take the URL:

http://skepticalgamer.com/slam-the-controller

and rewrite it to:

http://skepticalgamer.com/category/slam-the-controller

Ben S
very well commented as i stated earlly of the complications this could imply.
Prix
The URL above is the only case in which I want this rule to take effect. I don't want "anything" coming in to be prefixed with category. I only want that full URL to be replaced by that one shorter URL.
Chris Stewart
I see, I've modified the rewrite rule for this specific case.
Ben S
yes but in this case he would need to specify each category by hand, it would be more suitable if he follows the step to change his permanent links with his custom structure within wordpress admin as he said he is using it.
Prix
A: 

Then what you want is this: http://codex.wordpress.org/Using_Permalinks

Make sure you have the right setup on your permanent links at your admin on wordpress so it will recreate the links shorter like you want.

alt text

Prix
+1  A: 

Removing the category base is easily done with Wordpress Plugins » WP No Category Base, making changes in .htaccess unnecessary. The plugin doesn't permanently change URLs in the database, so if you disable the plugin, you get your category base back with no 404s for posts.

songdogtech