• Resolved dzarelli

    (@dzarelli)


    Hello everyone.

    I have what I feel like should be a simple issue/fix. We have a large multi-site instance that’s been around since like 2011. We are migrating the site and all data to a new host (AWS). The root domain will change as part of this work. Simply, our plan is to stand up the new instance, import all the data, test, then apply a 301 redirect from the old domain to the new one. Thing is, all the guides I can find for redirecting using .htaccess specify that I would need to specify the old and new links individually in .htaccess – The plugins I’ve found just allow me to add the redirects in the UI, but I would still need to include every specific URL to redirect from>to. On a multi-site instance like this it’s thousands of lines. I’m trying to see if I can redirect the entire site in .htaccess somehow.

    In short, I want to take my current multisite instance – we’ll call it https://blog and redirect any and all links to https://blog.mydomain.com. Our permalink structure for our instance is “https://blog/site” if that matters. We have 70 subsites, so I need to ensure anyone visiting the old links (for example https://blog/gallery/…) are redirected to the new domain and the path data is preserved (so if they browse to https://blog/gallery/… they should be redirected to https://blog.mydomain.com/gallery/…).

    Thanks for taking the time to help!

    • This topic was modified 4 years, 11 months ago by dzarelli.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I haven’t tried this myself, but it’s something that I know works.

    Have a read of this:

    https://www.seoptimer.com/blog/wildcard-redirect/#Using-.htaccess-for-wildcard-redirect

    You can skip a fe of the steps as they are very low-level to start off with, but take note of the section on “Redirecting an old domain to a new domain” as it sounds like that’s exactly what you need.

    Thread Starter dzarelli

    (@dzarelli)

    Thanks for that! That was actually really close, but resulted in a 500 error on the site. I tried a few things and this is what ended up working for me:

    Renamed existing .htaccess to back it up, created new .htaccess file containing the following ONLY –

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(.*)?blog [NC]
    RewriteRule ^(.*)$ https://blog.mydomain.com/$1 [R=301,L]

    So again, just a slight variation from what was in the article you linked. obviously, my existing instance doesn’t have a top-level domain (a .com or anything after the dns hostname) so if yours does you’d want to use that in line two. So if my original site was https://www.blog.com then the code would be:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(.*)?blog.com [NC]
    RewriteRule ^(.*)$ https://blog.mydomain.com/$1 [R=301,L]

    Anyway, thanks for pointing me in the right direction!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect entire multisite instance’ is closed to new replies.