pendatic permalink problem

I’m going to have to rethink the entire permalink structure for the ‘foo.

And not because I particularly want to, but due to a frustrating limitation in wordpress that should have been resolved a long time ago. It hasn’t and it still plagues a great number of peopleto this day.

Namely one simply cannot have an empty category base1 along with pagination — one can use /category/ or /archives/ or indeed anything else, as long as it isn’t actually missing entirely. We are told it is to “distinguish posts from pages or other content” - but if I don’t have anything colliding, because I purposefully do not do so — why can’t I disable that “feature”?

Now, I stepped neatly around the categories-must-have-a-base issue to begin with a few months ago, by having the following category base:

category base hack

.. it’s not pretty, but it works and sorts out the “I do not want you to force me to use a category base” problem. Because, I don’t. I really, honestly, do not want, or need, extra cruft injected into my URI structure. I like relatively cruft-free URIs. So do many search engines.

WP has taken care of the duplicate post and one cannot have duplicate category slug names. The only remaining risk is creating a page with the same slug name as a category - and anyone savvy enough to seriously depart for “usual” Wordpress URI conventions, isn’t likely to be quite that, well, stupid.

So it all works fine, as I mentioned, until one tries to navigate to, say /remainders/page/2 — which is when the oft-hated and less-than-logical internal re-write rules decide that a lack of a category base is all just a bit too hard, despite being technically a complete non-event and it thus spits out a 404 instead.

Again, there’s no technical reason for this to happen - the above structure is quite “unique”, however, because of the belief that people shouldn’t be able to set their own rules, or they just aren’t smart enough.. the safety trips and generates a 404.

And I’m not that keen to go hack the core to fix it, either. Because any hacks applied to the core, are going to have to be done again during any upgrade. Assuming I could even work out which “stock” rewrite rule enforces the behaviour, if I create a plug-in there’s no reason to expect it would still function during the next release, as core functionality has a habit of changing with little notice.

So I have two choices - lump the lack of pagination during category browse, or change my URI structure, again. The later of which isn’t a fun job and results in furious post editing on anything remotely popular to ensure links aren’t broken.

I don’t need to insert /category/ in my categories URI structure, as it’s entirely self evident! A journal entry, is in the journal category. A code entry, is in code. It’s not exactly rocket science.. and trying to figure out how to work around the Wordpress re-write rules shouldn’t be either.

Has anyone ever managed to successfully navigate this oft treaded path and found a solution?

Update: I need to figure out a way to enforce a rewrite of a crufty URI, such as &paged=2 to /page/2, as the former works to pull up additional pages. I’m pretty sure even if I get this right, Wordpress will enforce it’s might and squash it. Any re-write gurus able to make some suggestions?

For example: I need to rewrite http://www.smackfoo.com/journal&paged=2 to http://www.smackfoo.com/journal/page/2/

  1. .. empty as in no category period, i.e. “/” ()

≡ This is a journal entry relating to the topics of No Tags.

Brendan Borlase is a Systems and Network Administrator living in Adelaide, Australia, having lived, worked and breathed Information Technology for over 12 years. Learn more.

Feedback is encouraged. If you would like to read more, consider subscribing to the regularly updated RSS Feed.


  1. matthew

    Ive pretty much dropped categories entirely now and use tags. Categories are there merely to easily separate asides from all the other posts and provide an easy reference for a few main tags before I just make up the others on the spot.

    In hindsight now though I would like to change my permalinks and just remove the day from the year/month/day URL in the permalinks. Unfortunately that would probably break my hand entered permalinks and I just can’t be doing with that.

    Good luck with your quest (Ive been watching a friend play Fable on the Xbox and now I’m fully into questing - Fable is very funny btw).

  2. brendan

    I use tagging as well ;)

    However I wanted categories to act as ‘containers’ for differing types of posts. Hence the /journal, /code, etc.

    They’re great for keeping content defined. On further reading today I have discovered it simply cannot be reliably done.

    It’s a core design “feature” of Wordpress that appears impossible to break without destroying the other re-write rules in the process.

    Whilst most other blogging platforms have evolved - Wordpress is still fundamentally designed around a pretty strict set of re-write rules.

    It’s a total nuisance, because having something like /category/journal/ is a fundamental overstatement.

  3. brendan

    As a side note I have settled on /articles as the category prefix. It’s not ideal - but will do for now.

    At some point I’m going to sit down and work out just what URI structure makes the most sense, both for entries and categories.

    To be honest whilst tagging is great - the category thing is another item for the fast growing list of “reasons to stop using Wordpress”.

  4. BigBerries

    Hello there it seems I’m not the only one still wishing this would go away without the need for a hack of the core.

    One solution I’ve been toying with is creating a “page” with the category name and placing “posts” on the page.

    Example: [code][/code]

    In the meantime here are two solutions I’ve come across. One is a hack, but it is minor.

    http://www.clausheinrich.com/seo/

    The other is a plugin which appears to do the trick as well.
    http://fortes.com/projects/wordpress/top-level-cats/

    Neither have I tried but they are both on deck for experimentation. Have a good one.

  5. brendan

    Thanks for that..