[resolved] 301 Redirect for Permalinks? (5 posts)

  1. Thea
    Posted 2 years ago #

    I've just had to change my permalinks because I've upgraded to a proper directory theme, instead of a half-baked DIY directory.

    Permalinks used to be "bellydanceoz.com/%year%/%month%/%postname/"

    Now I've chosen "bellydanceoz.com/%postname%/" but the Listings are custom posts so they have a base URL ("profile"). Therefore in practice, the new permalink structure is "bellydanceoz.com/profile/%postname%/".

    Is there something I can put in my .htaccess file to redirect one to the other? The postnames haven't changed.

    I've tried using a couple of the Permalink redirect plugins but they're not doing the job reliably. Besides, none of them builds a list of redirects - they just do it "on the fly", which means reliability is never going to improve. I'd be happy if I could find a plugin that built the list of redirects, then I could go in and tweak the few that didn't quite work.

  2. Tara
    Volunteer Moderator
    Posted 2 years ago #

  3. Thea
    Posted 2 years ago #

    Thanks - unfortunately neither of these plugins is being supported any more. The second one looks as though it would be perfect, but it doesn't work because there's no way to tell it to include the base URL.

  4. Thea
    Posted 2 years ago #

    Update - I just found exactly what I was looking for. Should've thought to check Yoast's blog first!!!


    So simple, worked like a charm.

  5. Thea
    Posted 2 years ago #

    Eek, no it didn't because the redirect is in my main domain, and if I put it in the htaccess for that domain, it's applying to all my sub-domains as well.

    This is the code I'm using. I don't mind if it applies to all sub-domains, provided it redirects within the sub-domain (so, e.g. the redirect goes to "dressforflamenco.com" within dressforflamenco.com etc).

    Anyone know how to change it so the domain name is a wildcard?

    RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://bellydanceoz.com/$3

Topic Closed

This topic has been closed to new replies.

About this Topic