• Previously, I was using the permalink structure of /blog/archives/YYYY/MM/DD/POST-TITLE/ – Recently, I changed to /blog/POST-TITLE/

    I would like a nice little mod_rewrite rule that I can add to my existing .htaccess to redirect people coming to old permalinks to the new one. Can anyone help me out with this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Using_Permalinks has a Note on using only %postname%.

    From DrBacchus in #wordpress:
    http://people.apache.org/~rbowen/presentations/mod_rewrite.pdf

    Read the excellent discussion that happened on the wp-hackers mailing list. Here’s the beginning of that thread:
    http://comox.textdrive.com/pipermail/wp-hackers/2005-October/003062.html

    [Adding link to Kaf’s comment: http://wordpress.org/support/topic/38047#post-214615
    ]

    Thread Starter spaceninja

    (@spaceninja)

    I appreciate the concern, but I’ve already made this change, and my site is working fine. My CSS file and admin area are fully accessable (not that the codex gives any explanation of HOW this could cause a conflict with them). The shorter URLs are great, and I’ve already updated all the hard-coded links from blogs posts, etc.

    The only possible problem (which I’ve already addressed in another thread) is posts with the same post-slug, which WP won’t allow on new posts. It was only a concern with imported posts. I’ve already run through all my post-slugs for duplicates, and that problem has now been fixed by giving every post a unique slug. Similarly, none of my pages use the same slug as any posts, etc.

    The only missing piece to the puzzle is adding a mod_rewrite rule to redirect from the old format permalinks to the new ones.

    I’ll start looking through the mod_rewrite PDF that you linked me to, but I admit that I’ve never had much luck grasping the arcane methodology needed to properly write my own mod_rewrite rules, which is why I was asking for help here.

    Thread Starter spaceninja

    (@spaceninja)

    Okay, first the good news: The much, much simpler solution to my situation is to just copy in all my old mod_rewrite rules. This means that all my old permalinks work as well as the new ones.

    (the only downside is that I have to write-protect my .htaccess to keep WP from overwriting it in the future).

    One question, however: Should I add the R flag to the old rules so that they’re treated as a 301 redirect to keep search engines from accidentally continuing to index the old URLs?

    Note that as far as I can tell from the address bar in my browser, it already works. I type in the old URL, and the page loads, but the new URL is now in the address bar – but I’m not sure if the 301 signal is being sent or not.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need mod_rewrite help for new permalink structure.’ is closed to new replies.