Moving Wordpress Site to a New Domain

by John H
5 minutes

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

addon

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

Settings Tab in Wordpress

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

phpadmin

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!

Related Articles

Move Wordpress from folder to root domain

When you start a wordpress blog you might want to set it up in a folder called blog - or...

John H John H
~1 minute

Ways to Transfer Domains

It always amazes me how difficult it is to transfer a domain. I suppose it is hard for a few...

John H John H
6 minutes

Blocking Access to a Url route in Apache

This serves a 403 forbidden for any route with blog. RewriteRule ^(.*/)?blog(.*/)?/ - [F,L]...

John H John H
~1 minute