[resolved] Redirects or Custom Permalinks for a Single Category (13 posts)

  1. Hi there,

    I am merging a few separate WP sites into one WP site and have run into a conundrum.

    One of the sites that's being merged into the new one has a single-post permalink structure like this:


    (This site only had one category.)

    Nearly 200 posts from this site are being merged into a new site, which has a permalink structure for posts like this:


    I am trying to have post URLs from the old site automatically redirect to their counterparts on the new site.

    The problem, as you can see, is that the new site incorporates the month and year of the post, so there's no easy way that I can think of to set up an .htaccess rule to redirect the old URLs to the new.

    Of course I can set up an .htaccess with 200 separate lines, each redirecting an old URL to new, but that's tedious and I thought there must be a better way.

    Then I thought of an alternative:

    What if there was a way to set up a different permalink structure for a single category?

    That way, URLs on the new site for posts in this category could look like: http://www.newdomain.com/category/category-name/post-name/

    ... and I could now do site-wide redirects via .htaccess

    The catch is that I can't find a way to do any of these things.

    I found one plug-in called Custom Permalinks which allows you to set custom slugs on a per-post basis, but that would still entail me going back and changing the slugs on the 200 posts in the affected category.

    Any suggestions or workarounds appreciated!

  2. Do they need to be merged with the extant posts? My first thought was 'Why not make a CPT for 'category-name' and shove 'em all in there.'

  3. Very good thought! (And it had crossed my mind as well...)


    > Do they need to be merged with the extant posts?

    Yes, that's what the client wants/needs. These posts are being merged with another blog for a variety of reasons.


  4. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    You could probably just rewrite /category-name/post-name/ to /post-name/. As long as there are no conflicting page names it will work.

    Try http://atypicalife.net/hello-world/

  5. Hi Ron, thanks for your suggestion! I'm not sure I fully understand how this would work in practice to solve this dilemma. Would you mind expanding a little?

    Many thanks!

  6. And also just to clarify, the permalink structure for the rest of the blog (apart from this one category) needs to stay /YYYY/MM/post-name/ - as there are even more imported posts from another blog that have that structure!

  7. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    Hi Kathy, as long as you are using pretty permalinks & there are no conflicting cats, tags, etc. then WP will find the right post with just http://domain.com/post-name/ even if the pretty permalinks specify another permalink structure.

  8. Oh my goodness - I think I see what you mean!!!

    Even though the structure is actually:


    if I use:


    WordPress still gives me the correct page!

    This is AWESOME. Thanks so much Ron, you're brilliant.

    I just need to talk to my SEO specialist to make sure there are no implications on the search-engine front.

  9. Ron Rennick
    MultiSite Guru
    Posted 3 years ago #

    You're welcome :)

    WP will issue a 301 on the /post-name/ request so the search engines should be happy :)

  10. WP will issue a 301 on the /post-name/ request so the search engines should be happy :)

    Oh my goodness. I just tested this and you're absolutely right.

    Thanks again for all your help, you've made my day. :-D

  11. Ron FTW!

  12. Heh - just came back to mark this resolved - thank you to whoever had already done it. ;-)

  13. You're welcome ;)

Topic Closed

This topic has been closed to new replies.

About this Topic