• My current URI structure is /archives/%year%/%monthnum%/%day%/%post_id%/%postname%/ but I’ve noticed other users skip the initial /archives part. Is there any advantage to keeping it? If not, is there any way to “grandfather” the old links that still have “/archive” in them? I’m looking for some general rule that will make /archive/foo redirect to /foo.

Viewing 15 replies - 1 through 15 (of 18 total)
  • When you change the structure, DO NOT overwrite the rewrite rules already in your .htaccess. Just add the new ones. That should allow old (and off-site) links to continue working, whereas internally-generated links will use your new permalinks.

    Thread Starter xrlq

    (@xrlq)

    That seemed to work, thanks. Can the rewrite rules be nested, e.g., would one rule like this one do the trick instead?

    RewriteRule ^archives/?(.*) /$1 [QSA]

    Having never tried nesting rewrite rules, I’d have to say…….maybe.

    Thread Starter xrlq

    (@xrlq)

    Or maybe not. I just tried it and it screwed up one of the new permalinks. I’m sticking with your prior suggestion instead.

    Is there any advantage to using the “archives” folder at the beginning? I assume that without it, you can still create all the folders you want under htdocs, as long as their names don’t match the first argument to any rewrite rule?

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    /archives/ is required if you’re using a version of WP prior to the slightly-unstable v1.5b.

    http://codex.wordpress.org/Using_Permalinks

    Thread Starter xrlq

    (@xrlq)

    That page doesn’t say anything about /archives/ being required. What happens if you don’t use it?

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Apparently, permalinks in v1.2.2 don’t work without /archives/. Of course, I’m only suggesting that after months of seeing it work as a solution for hundreds of similar problems presented on these very forums.

    Thread Starter xrlq

    (@xrlq)

    I use 1.2.2, and as far as I can tell, my permalinks are working fine.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Wasn’t this whole thread about your permalinks not working? Did you fix them?

    I’d be interested if someone has found a solution for this one, too. I am playing around with the Feb 04 nightly on my local dev server, but can’t get my preferred permalink structure to work:

    /archives/%year%/%monthnum%/%day%/%postname%/

    I want to keep the /archives/ on the URL so that when I upgrade my production site I don’t break any of my old permalinks (and besides, I think it looks nice).

    There are a few other topics on the forums with similar queries, but I am yet to find one that has a solution. Has anyone solved this one?

    Thread Starter xrlq

    (@xrlq)

    Not really, Macmanx. It was about whether or not the /archives/ actually did anything, and if not, how I could drop it without breaking all the past links. Kafkaesqui’s advice seems to have solved it.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Cam, if the permalinks are working on your old site, then you should have no trouble uploading the new site and keeping the same permalinks. More than likely, your local dev server does not support mod_rewrite.

    macmanx, I am using mod_rewrite for a couple of other things, running on other virtual servers on the same Apache install (2.0.52 under OS X 10.3.7.). And with my local 1.2, nice URLs work just fine. I have messed about with the 1.5-generated .htaccess a bit to see if I could get it to work, but no dice so far.

    Kafkaesqui’s advice (above) about keeping the old rerwrite rules doesn’t really work in this instance, as I’ve created a brand-spanking new virtual server for a fresh install, so there’s no old entries on this partiular blog.

    I might try copying some over from my local 1.2 and see if that works.

    OK, just for reference, copying the rewrite rules over from my local copy of WP 1.2 made it work. In as far as it goes, this is fine, but I have heavily hacked that particular install and the associated .htaccess, so I’ll have to see if it causes any other carnage with the new install of 1.5 I have running.

    More importantly, though, was that the 1.5 install didn’t work right out of the box. Has anyone come up with a fix for a brand-spanking new WP?

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Well, v1.5b is still in beta form, so it’s pretty much unstable and under construction.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘changing URI structure’ is closed to new replies.