How to redirect permalinks after structure change (6 posts)

  1. Thea
    Posted 2 years ago #

    I've changed my domain to a directory and I need to redirect my permalinks.

    This method from Yoast seemed to work perfectly, pasted into my .htaccess file:


    But then I realized a HUGE snag: I have sub-domains which don't need this redirect, and the code is applying to them too, resulting in a pile of 404 errors.

    How can I modify this code so it applies to the main domain only?

  2. leejosepho
    Posted 2 years ago #

    Each of my sub-domains has it own registered domain name and its own htaccess file, but yours do not? My thought here is that maybe there is a way to add that if they do not.

  3. Thea
    Posted 2 years ago #

    Yes, each of my sub-domains has its own htaccess file, which is why I didn't expect this problem at all!

    It seems as though the htaccess for the primary domain is taking precedence over the htaccess for the sub-domains.

  4. leejosepho
    Posted 2 years ago #

    Hopefully someone here will know what you can do to fix whatever is going on...

  5. leejosepho
    Posted 2 years ago #

    After reading what AITpro explained to someone else here...
    ...I am wondering whether you simply need to add htaccess permalinks code to your sub-domains.

  6. Thea
    Posted 2 years ago #

    Thanks, but I'm not sure the posted solution helps me.

    The Yoast code I used was:

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

    If I could make the website name (http://bellydanceoz.com) a wildcard in that expression, so it would redirect within the domain or sub-domain, it would be fine.

Topic Closed

This topic has been closed to new replies.

About this Topic