10up / MU-Migration

This WP-CLI plugin makes the process of moving sites from single WordPress sites to a Multisite instance (or vice-versa) much easier. It exports everything into a zip package which can be used to automatically import it within the desired Multisite installation.
MIT License
324 stars 48 forks source link

Question: When Wordpress is installed in a subdirectory but site addresses should be at the root #84

Open ramaxfield-git opened 3 years ago

ramaxfield-git commented 3 years ago

Hello! Thank you for your earlier help - I've been able to get my single sites zipped up in preparation to move them into a multisite. However, my multisite installation is configured so that all the Wordpress files live in a /wp subdirectory, but the site URLs should wind up at domain.com/site1, domain.com/site2 etc. Should the migration command be run, and the .zip files to migrate located, in /wp or at the root? I don't want to get it wrong.

Thank you!

nicholasio commented 3 years ago

Hi @nicklaussemuse it shouldn't matter, it should work both at the root and at the wp/ subdir. This tool relies on WordPress functions wp_uploads_dir and get_theme_root to figure out paths so as long as you have a working wp installation all should work fine.

I should note though that I haven't tested with this particular scenario, so should you encounter any issue, feel free to let us know.

ramaxfield-git commented 3 years ago

Okay, interesting development! What happened when I ran the import command was that it simply made the temporary installation (at /wordpress_temp/site1) part of the multisite network. This was of course not my intent; I'd like it to exist at /site1.

Is this something that using the --new_url parameter will solve? I didn't include it because I thought that "perform a search and replace" would be something else, but if that would make it end up in the right place, that would be good. And further to that, I'm currently doing this on a server with a temporary address before we retarget our server.example.com url to the server currently located at new-server.example.com - so would I be able to write "--new_url=/single-site" without the "example.com" part of the parameter?

ramaxfield-git commented 3 years ago

Just wanted to check in and see if you/someone else had any advice here. I tried installing with the flag "--new_url=/single-site", but it wouldn't do it - is my only option to do it in a hurry after we change the development server's URL to the one it's meant to be using (ie. make the site live without things being properly built and ready)? (Or if I install it at "--new_url=http://new-server.example.com/single-site", will it end up in the right place after that server becomes server.example.com?)

splaquet commented 3 years ago

folks can correct me on this one... but, if i'm following you, it might be easiest to push a 'wp search-replace 'old.url.com' 'new.url.com' --precise --network

but, on the --new_url= tag, you'd want either: --new_url=subdomain.domain.com --new_url='domain.com/subfolder'

ramaxfield-git commented 3 years ago

@splaquet, the issue I'm referring to is that I'm importing these sites on a server that will be changing its address when the migration is complete. I want to avoid a situation where I import a site to TEMPDOMAIN.COM/subfolder, the server becomes DOMAIN.COM, and the site breaks. Because I don't know what exactly gets written where with that command and if a site imported at TEMPDOMAIN.COM/subfolder will still work at DOMAIN.COM/subfolder when the server currently operating as TEMPDOMAIN.COM becomes DOMAIN.COM - does that make sense?