Moving a WordPress site is a pain, but not impossible. There are many scripts and applications that can do the work for you if you’re pressed for time, or not comfortable doing it yourself. Me, I’m a do it myselfer; I spent a good couple hours one night moving my sites around and cleaning things up.
Now, this is a quick walk-through of the process I took. If these notes are helpful to you, that’s great, that’s why I’m sharing. But if you’re not already familiar with cPanel, WHM, and command line (SSH), this may not be of any help to you. When in doubt, ask your webhost for help! :)
I’d made multiple backups in the process of the anticipated migration from Lunarpages to KnownHost (who is quite awesome by the way and I love to bits!), and knew that everything on the site was contained in many redundant backup files, so I was ok if something was deleted erroneously. I had been pruning my domains over the course of the last couple of years, letting some go, while planning to rebuild or move others. A couple hobby blogs that were no longer updated I had moved to Tumblr. Three others I decided to let go. So, I could delete the folders and files belonging to those.
Any addon domains that I planned to keep needed their own cPanel account. So, I created those. I then copied the files from the subdomain folder located in my main domain’s public_html folder to the new account’s public_html folder. I moved them via the command line, so I had to go behind and clean up the ownerships using these commands:
Change ownership for each directory to the cPanel user for it:
# for i in `ls /var/cpanel/users`; do chown -R $i:$i /home/$i/public_html/*; done
Etc. folders need user.mail ownership and public_html needs group owner as nobody, so use the following commands to fix the issue:
# for i in `ls /var/cpanel/users`; do chown $i:$i /home/$i -R; done
# for i in `ls /var/cpanel/users`; do chown $i:nobody /home/$i/public_html; done
# for i in `ls /var/cpanel/users`; do chown $i:mail /home/$i/etc -R; done
After I fixed the file ownerships, I created a database and user on the new account. I then exported the data from the old WordPress database to a .SQL file and used that to import it into the new database. All that was left then was to update the wp-config.php file with the new database name and credentials.
The only snag I ran into was that the site would not load, giving no error message, only a blank screen. After double-checking everything, I remembered that I had forgotten to turn off the caching plugin before moving the files. As soon as I deleted the cache directory, the site came right up.
I had no emails or anything of that nature on this domain, so I didn’t have to fool with that. All that was left after all this was to make my DNS changes on my domain’s record with the registrar pointing to my new nameservers.
Granted, if I had emails, addon domains, parked domains, and much more, this would have been a nightmare. cPanel currently does not support an addon-to-account migration but I know of someone working on a script to do this. Who knows, maybe it will be supported soon. But in the meantime, I hope my notes are helpful to someone. Just be sure to go back behind yourself and clean up any leftover site files, and be sure to remove the addon domain from your old/main’s cPanel account.
I will say this … running a VPS is more work than having a simple shared hosting account, but very much worth it if you’re willing to put the time in to learn how to admin properly. That said, I know I can trust my host‘s support team to help me if I screw something up. LOL!