A Plea for WordPress Help

  • Published: 01.06.2009
  • Categories: Web
  • Comments: 10

I love using WordPress to power websites.

While it began strictly as a blogging platform, it has evolved into a pretty solid CMS, but there is one little thing that has been bugging me for a while now.

With the launch of my redesigned site, I was interested in using the WP-PageNavi plugin because I think it provides much better paging than the default WordPress previous/next.

The problem is that WordPress includes /category/ in the URL, and I hate it. For example, on my blog page, you can click the older entries link at the bottom of the content area, and you can see that the link points to here:

http://trevordavis.net/blog/page/2/ 

But, you will notice that you actually get redirected to:

http://trevordavis.net/category/blog/page/2/ 

I had to do this because /blog/page/2/ returned a 404 error. You can see this by going directly to the third page.

Some Suggested Fixes

I read through a couple of forum posts discussing the problem, but none of the fixes mentioned seemed to work.

The most discussed suggestion was to change the category base permalink to /., but that did not work for me. Surprisingly, some people said it worked for them. That was pretty bizarre to me, so I kept looking.

Another suggestion was to edit a core WordPress file, which I do not want to do.

Plugins to Fix the Problem?

I came across 3 plugins that were supposed to fix the problem, but none of them worked for me either.

My Idea

So I am not the greatest with regular expressions and htaccess and all that jazz, but my thinking is that I can use the Redirection plugin to use a pass-through to rewrite any link like this:

/blog/page/(*)/ 

To this:

/blog/page/$1

Is that not possible? I could not get it to work. Does anyone know how to get something like this to work? WordPress team, why has this been a problem for so long?

9 Comments

Andy

01.06.2009

Hey Trevor:

Been stalking you on RSS so figured I’d try to add something useful. I’m no Wordpress expert, though I do use it for my personal blog. I typically use Drupal more in my freelance work.

By ‘core Wordpress file’, were you referring to an .htaccess file? If not, this would be fairly trivial to implement using mod_rewrite.

Trevor

01.06.2009

@Andy-
When I meant core WP files, I mean php files in the wp-includes folder that would get changed with each upgrade.

I thought it would be a simple rule in an htaccess file, but what I tried didn’t seem to work. Was my rule incorrect?

Jason

01.06.2009

I’ve never heard of someone not being able to change their permalink structure. I mean, Wordpress provides this in the configuration specifically for this issue.

Please see the screenshots here for example with just post name: http://www.flickr.com/photos/jasonbrummels/3174520154/sizes/o/

...and here for a screenshot of the permalink configuration: http://www.flickr.com/photos/jasonbrummels/3174520356/sizes/o/

From my experience…and web searching…this is the most user and SEO friendly permalink configuration.

Trevor

01.06.2009

@Jason-

No, I could change my permalink structure if I wanted (but that it not what I want). I want to change the category base. If you look at the screenshot you sent, there is an optional section below that allows you to change the category and tag bases.

See how on your blog, you have the following:

http://jasonbrummels.com/category/technology/ 

I would want it to be:

http://jasonbrummels.com/technology/ 

I actually use /Ętegory%/%postname%/ for my permalink structure. I want my site to be more link a full site, and not solely a blog. Hence, I want to get rid of category in the URL.

Jason

01.06.2009

I see…and I thought I was so helpful. Nope. :)

Tom

01.06.2009

Trevor

01.06.2009

@Jason-
Hah, no worries. I appreciate the thought and effort you put into the comment. I realized the post was going to be kind of hard to explain what I was trying to achieve, so that probably contributed to your confusion.

Chris

01.07.2009

@Jason
When Trevor asked this on Twitter, I answered the same way, having never noticed this problem myself.

Andy

01.07.2009

Trevor:

Hey, not sure of the .htaccess RewriteRule you tried, but the following will work:

RewriteRule   ^category/(.*)$  /$1   [L,R=301]


Note there are still a few issues w/this approach:
1. We’re forcing the browser to make an extra request (for the 301 redirect) which will be (just a bit) slower
2. The URLs themselves (that’ll end up getting indexed by search engines) aren’t changing to what you want; we’re just redirecting to a pretty version
3. This approach also requires modifying a ‘core’ wordpress file, as Wordpress comes packaged with a .htaccess file at its root. Though the addition is small, just add the rule directly after Wordpress sets the RewriteBase:

RewriteBase /
RewriteRule ^category/(.*)$ $1 [L,R=301]

-Andy

Too late, comments are closed!

Don’t worry, you can email me or contact me on Twitter.