Support » Fixing WordPress » Multiple permalink format?

  • atmasphere

    (@atmasphere)


    Is it possible to support more than one permalink format for posts?
    I’d really like to use /archives/%year%/%monthnum%/%day%/%postname%
    but I want to make it easier to redirect my old MT blog which used something more like /archives/%post_id%/
    I have them both in my .htaccess and it seems to be working. Are there any issues? Should one be before the other to be the default?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator Matt Mullenweg

    (@matt)

    Nope, you can have as many “structures” in your .htaccess as you want, with no problems. I would recommend using the longer one as the default, as it’s more meaningful.

    Thread Starter atmasphere

    (@atmasphere)

    Very cool – thanks!

    chigh

    (@chigh)

    Now that permalinks are handled internally… is this possible and is there any documentation on how to put in the multiple structures?

    Any ideas on how to specify one permalink structure for posts in a particular category, and another for all other posts? Example – I want permalinks for items in the news catagory to be /news/YYYY/MM/DD/post-name/, but all other permalinks to be /category/post-name/. Is this possible?

    Just mentioning that the same question is asked and answered (for an older version of WP) here: http://wordpress.org/support/topic/36452?replies=2#post-206198. Wonder if this is still true. Time to dig into the code.

    At that time (version 1.5.x) every htaccess rule was in the file. Since 2.0.x the rules are handled internally, and the htaccess file is always the same. There might be a way, but probably deep inside the core files. (I don’t know)

    Thanks for the reply, moshu. I’ll start taking a look. I’d like to have some better documentation on the internals of how permalinks work, so maybe this is how I can give something back.

    Hey scottplumlee — this plugin might be useful for the research aspects (no, it doesn’t solve your issues): http://www.dagondesign.com/articles/wordpress-internal-rewrite-viewer-plugin/

    But if you’re ever curious about what WP is doing “under the covers” for rewrites, it’ll sure help.

    Work not, it did, young Solo, until I updated my .htaccess file. Saw the instructions in your comments. Thanks for the tip.

    Also wanted to add – from reading the Apache documentation, the .htaccess file is less efficient than adding a <Directory> entry in the httpd.conf file and applying the permalink structure there. I believe it has to do with how .htaccess files have make Apache check every directory above the current one for .htaccess files, but I could be wrong. Since it’s normally, in the root folder, it’s not a huge deal. I wonder if there would be a way that you could include an option to add the rewrite rules to that file rather than creating a .htaccess file. I realize not everyone has control over their Apache install, so that’s why it would have to be an option.

    I realize not everyone has control over their Apache install

    It’s quite the opposite: the majority of WP users do NOT have control since they are on a hosted environment.
    I admire anybody who can write a line of code (because I can’t) – if they don’t forget about us, non-geeks 😉

    Hmm, not to split hairs, but:
    I realize not everyone has control over their Apache install and the majority of WP users do NOT have control since they are on a hosted environment. are saying the same thing.

    I was trying to make that exact point – if you don’t have control over the install, httpd.conf is probably off limits for you. But if you did have control, then it would be nice and tidy to be able to include the Directory code. But then again, making a .htaccess file world writeable and making your httpd.conf file world writeable are miles apart in security implications, so should probably think a little more before I type. <grin>

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Multiple permalink format?’ is closed to new replies.