Moving WordPress Site to a New Domain
Scenario: You bought domain, JohnsHatDogs.com. You configured the DNS and it’s pointing to your hosting provider’s name server. You installed WordPress. You’ve started updating content and got a great Hot Dog Theme – just perfect for making people salivate at the thought of your delicious hot dogs. Your site is totally rocking out.
Wait a second… Did I just buy and completely build my website at JohnsHatDogs.com? That should be JohnsHotDogs.com!! Ahhhh fiddle sticks!
Sooo you buy JohnsHotDogs.com – you point the DNS record to your web hosts name servers. You setup the addon domain so that the server is accepting the new domain name. Now you get the the part where you would normally just set up your WordPress installation, but this time we have an issue – I just spent all this time building the site, and I don’t want to have to go through that process again. So how do I get new domain pointing to the old site?
You’ve got to do a few things.
1. Point Your Domain to the correct directory
If you are using a webhost like host gator you add all of your domain entries through the Addon domain manager. In this case you need to add the domain, but you don’t need to add a folder for the contents of the site – it was already created when you set up the previous domain. For example when you set up JohnsHatDogs.com you would have a directory probably called johnshatdogs – In this scenario, when adding JohnsHotDogs.com you would just have that domain point to the directory johnshatdogs . Even though the document root is incorrectly labeled, it contains all of the contents of your site. You could always FTP in or rename that directory – but if you didn’t want to go to that trouble just point your new domain to the old root directory.
2. Change your WordPress Site Url
This is the biggest and most important functional issue when moving the url of a WordPress installation. Once you setup your domain name – and point it to the correct server directory – your site should show up, however the theme may not completely work and you will only be able to see the home page – if you click a link or try to login you will get a 404 error.
There are two ways of fixing this – either change it through WordPress’s Settings Tab – OR – going through the database and fixing it through the database wp-options.
2.a Fix WordPress Site Url inside WordPress Admin
If your original domain (JohnsHatDogs.com/admin) is still working just login and goto the settings tab in your admin panel. Once at that screen you will change your Site URL to the new one. As soon as you save this setting you will not be able to your admin panel from the original site’s domain. This will kick you out of WordPress. At this point your new domain should start working and you would get to the admin panel of WordPress by going to JohnsHotDogs.com/admin
2.b Fix WordPress Site Url inside PHP Myadmin or through MySQL
If you don’t have access to the original Domain (perhaps the domain expired or it was setup by someone else who owned it – whatever the case is you can’t get in) and you can’t get to http://www.JohnsHatDogs.com/admin then you will need to get into Mysql and change the settings manually.
Once you are in PHP Myadmin go into your wordpress installation’s database. Go into table wp-options. You will need to edit the table row for option_name siteurl. It should say http://www.johnshatdogs.com. Click to edit this row and put in the new url, http://ww.johnshotdogs.com. Once you save your new domain should work.
That should do it!