WordPress.org

Support

Support » How-To and Troubleshooting » permalink change via .htaccess

permalink change via .htaccess

  • my blog is set up with the following permalink structure: /%category%/%monthnum%/%year%/%postname%/

    I would like to change it to this standard structure: /%year%/%monthnum%/%day%/%postname%/

    does anyone a regexp expert and could help me with this?

    also, I have a blog with the traditional domain.com/?p=84 setup. I would like to also convert that to /%year%/%monthnum%/%day%/%postname%/

    I suck at regexp. I have tried, I am not looking for a solution, just help or an idea on how to proceed.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Why would you need to know regexp? Just change the options in the Options->Permalinks screen.

    Make sure you’re running the latest WordPress (2.3.2) before you make the change. Later versions of WordPress remember old permalink settings and redirect to the new permalink addresses.

    because I have a lot of posts that I would want to permanently move via a 301 redirect.

    currently I added a bunch of explicit rules for specific pages that I get a lot of traffic from but I think I need to match the pattern instead. any ideas?

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    because I have a lot of posts that I would want to permanently move via a 301 redirect.

    Again, I reiterate: “Later versions of WordPress remember old permalink settings and redirect to the new permalink addresses.” Yes, as in a 301 redirect.

    Changing permalinks means that the old permalinks will now send 301’s to the new permalinks. No need for any .htaccess changes. This is built into WordPress. As of version 2.3 or so, I think.

    holy cow thats huge, how the heck did I miss that?

    ummm, weird. it didn’t seem to work.

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Well, change it back then. It should have worked, but no harm, no foul.

    Looking through the code, I see that perhaps I’m confused. I see that it remembers old slugs, and that it will do canonical redirection as well if the link is slightly off (www instead of non-www) and that it will even attempt to guess if it can figure out what is the post_name. But it doesn’t check old permalink settings like I thought it did.

    I think that yours would have worked if you didn’t switch the position of the year with the day. Oh well. Lemme look at it some more.

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Here’s a plugin designed for this sort of thing:
    http://scott.yang.id.au/code/permalink-redirect/

    It has an option called “permalink_redirect_oldstruct” which lets you put in the old structure to have it redirect when needed. I’d try that.

    weird, it’s all working on both sites: nostatus.com and blog.movieset.com. so awesome. nostatus i managed to fix the redirect and movieset has the old posts being 301′;d to the new domain etc.

    thanks for the assistance ottoman 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘permalink change via .htaccess’ is closed to new replies.