Recently I moved a wordpress install from a sub directory to the current modX install root directory. Only this isn’t correct to say. I didnt know how to look for what I was about to perform at first, and was a little scared as this was the biggest website I’d rebuilt, ever! over 1400 pages! What happens if I have to manually change all the permalinks?
What I actually did was point the site sprinkle.com.au to the folder i designed the new site in: sprinkle.com.au/newSprinkle/ as this was now to be its root folder. All the files have to be in this new folder which also was a little scary but I found out Filezilla (and maybe its common practice?) lets you click and drag from one location to another – in effect a shortcut to the files current location, but satisfying the permalinks search for them being located in the same root folder.
So the steps for having the site coming from a sub directory are:
1. ‘click and drag’ any files not uploaded as part of the new site build (still in the old sites folders) into the new root folder in my case e.g. sprinkle.com.au/assets/images –> sprinkle.com.au/newSprinkle/assets/images
2. change the location of the root folder in your providers domain central e.g. sprinkle.com.au/ –> sprinkle.com.au/newSprinkle/
3. In WordPress [Administration -> Settings -> General] change the WordPress address e.g. (URI) sprinkle.com.au/ to sprinkle.com.au/newSprinkle/ and the Site address (URL) sprinkle.com.au/ to sprinkle.com.au/newSprinkle/)
4. Dont panic now no matter how much ya wanna! If you try and log in both sites are gone the old one and the one you just designed. Thats it. Gone.forever. Need beers quick. (I only had one btw, heh) There is some time here for the re-assigning (or correct term?). I think about 5-10 minutes later I stopped panicing. I could log in but it was no longer sprinkle.com.au/newSprinkle/wp-admin, it was of course now: sprinkle.com.au/wp-admin
5. after having logged in, the site seems a little, er, broken. Sprinkle is a fashion designer there are thousands of images on her site. And most of them were missing. Well to be precise, all the images with links referencing the old sites assets/images/ folder were missing. I was prepared for this.
6. install Better Search Replace(could have done it before but can do it now) https://wordpress.org/plugins/better-search-replace/ – this allows you to replace all the permalinks in the new site build that contained the new build folder in the uri link. So http://sprinkle.com.au/newSprinkle/happy-sprinkle-customers/ becomes http://sprinkle.com.au/happy-sprinkle-customers/ and, AND(!) just in case visitors (customers) click on a saved old site link, it redirects smoothly to the new page of the same name!!!
7. Phew. Better Search Replace changed 3991 links!!!!!