WordPress.org

Ready to get started?Download WordPress

Forums

Permalink Structure,Re-write Rules and WP Pages (6 posts)

  1. Christopher J. Hradil
    Member
    Posted 7 years ago #

    In this post there's an interesting discussion of how to acomplish a number of things with regards to permalink structure, and making changes, etc. It got me thinking about a request I've had from a couple of clients that I just haven't felt like playing with (mainly because I haven't been able to come up with much recent/relevent info on the subject). I know that the Codex needs some updating in this area and much of the information there at the moment on these subjects is really more relevant to 1.5.

    That being said, here's the issue (well, two issues);

    Part 1 - I've got a couple of sites with a limited number of (say 10-20) existing html "pages", the sites/pages all have an existing google page rank of 6-8, the site owners would like to migrate to a simple to use cms or publishing system (i'd like to use WP obviously), but not loose the existing page rank, and get the existing page content into the WP or CMS system. Typically for my own site and a couple of others I operate which use WP, I use date base permalinks like yyyy/mm/dd/post-name-or-slug for posts, and pages end up looking like site-root/page-name-or-slug.
    On a couple of occasions in the past I've used permalinks to append .html to posts (to retain page rank and permalink structure for sites migrating from things like MT/TP where the .html ending was the standard) --- Can the same thing be achieved for pages ? I've played with this a bit, but haven't come up with much that really works cleanly and simply other than "hack" methods using contorted .htaccess re-write rules. It also doesn't scale very well for larger sites. Any ideas ?

    Part 2 - Category permalinks --

    why does WP seem to default to /category/my-cat-name for links/permalinks to posts via categories ? Isn't the /category part just unneccesary cruft in the URL ? I'd prefer links that simply look like /my-cat-name/post-name
    This could just be a dumbass I missed the codex page issue, but how can I get rid of the /category part ?

  2. Chris_K
    Member
    Posted 7 years ago #

    Part 2. I may misunderstand your question. In Options -> Permalinks, if you leave the category field blank, you get "category". Otherwise, whatever you specify there ("cats", "stuff", "bob") goes in the link in its stead.

    You can't completely drop it as then your category only pretty permalinks have a real good chance of crashing into your WP Pages.

  3. Christopher J. Hradil
    Member
    Posted 7 years ago #

    Part 2. - I understand what you're saying, if a user were to create a WP 'page' called cats and a 'category' called cats, things would bork without the /category (or whatever you put in the category field) part. I suppose that in part I'm assuming that folks using pretty permalinks like that would have enough sense not to create a 'page' and a 'category' with the same names/slugs. Personally (and for a couple of clients) I'd like to drop the /whatever part, and work within the guidelines that a category can't be named the same thing as a page/slug. No matter what you put in the field (or if you leave it blank and get /category) it just ends up being extra un-needed cruft in the URL in most cases. I can see making a case for using the word "tags" in place of /category since tags are currently somewhat of an "in" kind of thing, but in the long run, it's just extra fluff.

    While I understand why it's written (WP Core) that way, I don't see a meaningful use for that 'chunk' of the URL (other than as you mentioned avoiding crashes with other pages/permalinks, which if that's the only reason it's there, it's a pretty poor design), I could see using something like %authorname% on a blog with many authors, or something like that, which at least makes a little bit of sense, but just sticking some extra 'stuff' in the URL to compensate for users that would 'do' without thinking, and end up creating the naming conflict you've mentioned doesn't seem practical.

    The same 'clash' or 'crash' situation exists even with /category or /whatever you put in the box anyway -- suppose a user puts 'cats' or 'bob' in the category field, then an actual category called "spots", you run into the same crash/clash if a user creates a page called "bob" and a sub-page called "spots", or a page called "category" and sub-page called "spots". So why not have the ability to just eliminate the cruft ?

    ....off to the sandbox....

  4. Chris_K
    Member
    Posted 7 years ago #

    Oh, I dunno that you'll find me arguing with you. I suppose it's been a few months since the last brave knight stormed the wp-hackers list...

    And my search-fu is weak, I could've sworn somebody posted a hack / work-around earlier this year on way to get around it. Darned if I can find it right now.

  5. Christopher J. Hradil
    Member
    Posted 7 years ago #

    I raised a similar issue on the hackers list a couple of weeks ago, and the discussion pretty much degraded into a number of .htaccess hack solutions for part one, but I don't think we really got into the /category thing. I've done a bunch of searching, etc, and haven't been able to come up with anything solid (short of hacking around in core) to get rid of it though.

    At the moment, I have enough folks (granted they're mostly seo paranoids, and have some kind of religious fanaticism about URL depth) asking me to rid them of the /category part, I'm going to have to do something about it.

  6. Christopher J. Hradil
    Member
    Posted 7 years ago #

    ok, tried it out in thesandbox

    see the bob and cats posts/pages it borks exactly as expected. the /category or /taxonomy/tags thing (other than for something like %authorname% as mentioned above) is useless cruft, it's just as easy to create permalink crash/clash issues with them as without.

    i've created a page called cats (the parent page) and a sub page called bob, as well as a category called bob, a category called cats and a post called bob, and it is as dysfunctional as I had expected.

Topic Closed

This topic has been closed to new replies.

About this Topic