• Resolved LachlanM

    (@lachlanm)


    Hi,
    I’m merging a number of blogs on a multisite setup using the export/import posts and users tools.
    That works fine but I would then like to 301 redirect the posts from the old site to the new site and delete the old site.
    I’m wondering if someone who has done this can shed some light on the best approach. I’ve redirected one domain to another in the past, but this a subdomain of a WP multisite redirecting to another subdomain, and WP multisite already does some 301 redirection stuff of it’s own which I don;t want to break – e.g. I deleted one old blog that had no posts in it (didn’t need to redirect anything) but visiting that deleted blog redirects to the homepage of the multisite setup, which is great in this instance, but for the old posts that are being merged into a new blog I would like to redirect so that anyone looking for those ends up in the right place.
    Thanks,
    Lachlan

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    .htaccess is the best bet.

    https://halfelf.org/2012/htaccess-anarchy/ has some tips, but basically you’ll do a check for ‘if oldsub.domain.com’ first and then redirect ?? I do it on my old subsites too.

    Thread Starter LachlanM

    (@lachlanm)

    He Mika,

    Thanks for the reply. I’ve been looking into this but am still having trouble.

    It seems you can only redirect a subdomain by putting a separate .htaccess file into the directory for that subdomain – you can’t do it with the .htaccess for the root domain.

    However, with WP Multisite sites there is no directory for each subdomain.

    Does anyone have any thoughts on how this could be accomplished?

    Thanks,

    Lachlan

    Thread Starter LachlanM

    (@lachlanm)

    I’ve solved the issue.
    It may have had something to do with the fact I’m using cPanel/WHM to manage my server. The scenario is as follows, I wanted to redirect a subdomain to another subdomain, including all pages within that subdomain to the new subdomain.

    I don’t fully understand how WP multisite manages the subdomains virtually without actually creating a directory for each subdomain on the server. However, to get a subdomain redirect working i ended up creating the subdomain again via cPanel, then placing an .htaccess into that subdirectory with the following code:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) https://your-domain.com/$1 [R=301,L]

    Which achieved the required result of redirecting this
    https://fishrecipes.mydailyrecipe.com/
    to https://tinykitchen.mydailyrecipe.com/
    along with all blog posts in the subdomain to the new subdomain.
    If anyone is wondering, to move the content I simply exported the posts and categories and imported them to the other blog before deleting the site in WPmultisite admin and then creating the subdomain in cPanel.
    Cheers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Merging Blogs and 301 Redirect’ is closed to new replies.