Moving your Website to a new Domain Name
20 Dec
If you’re in the process of moving your WordPress website or blog to a new domain name then this article was written for you!
Whether you run an online web presence for your business or you just enjoy designing and deploying websites you may need to move a website from time to time, from one domain name to another domain name. It can be full of headaches, late nights and steep learning curves that can leave you pulling out your hair, wondering what you’ve gotten yourself into. Trust me, at times I’ve been there myself in the past.
Because most of the websites today run on at least one database it means that you need to not only keep the website CMS (Content Management System) software you are using up to date including plug-ins and add-ons but that you also need to perform regular database backups depending on how often you make changes and revisions to your website. Now, I am not covering how to backup and restore a database in this article specifically but I am going to show you some tools to help you move your mySQL database from one domain name to another and the problems that are presented when you move a mySQL database. For the sake of this article I am going to be talking about WordPress in this article; however the same concepts should apply regardless of the platform you are using to manage your website.
Recently, I myself found out that how valuable it is to restore a database to a different domain name. This can be a tricky process and before you attempt it make sure that you’ve got a current backup saved in a good place. Here are some problems that commonly occur when you move a mySQL database from one domain name to another domain name…
- You didn’t verify the backup of your database before restoring it to the new domain name. This may sound a little redundant but by verifying your back ups means that you don’t need to panic should anything go wrong. If you are looking for a good plug-in that you can use with your WordPress website or blog I would suggest a plug-in by the name of “WordPress Database Backup” to help you run backups of your website.
- Your mySQL database contains the old domain name when you restore the database under the new domain and it redirects you back to the original domain name with you login. This sort of thing happens because there is a conflict when you login that an application like WordPress looks and sees the old domain and then performs a redirect back to the original domain name and never allows you to fully login. In order to fix this problem you need to simply edit the “wp-config” file (if you are using WordPress) and add the following lines of code (see below) and upload it to the new domain’s web hosting.
define(‘WP_HOME’,'http://example.com’);
define(‘WP_SITEURL’,'http://example.com’);
- You’ve moved your mySQL database over to the new domain name and you are able to login but when you try to navigate the WordPress website or blog on the new domain name, the links point to the old domain name and you are unable to display the web page. Again there is a simple fix for this problem. The first thing that you need to do is to install a plug-in called”Search & Replace” that is available for WordPress on your website on the new domain name. From there the only thing that you need to do is type of the old domain name including the HTTP (similar to http://www.example.com) and the new domain name (similar to http://www.new-example.com) and it will update your database searching and replacing the original domain name with the new domain name. A few notes about this though, make sure that you save a backup copy first and verify its contents before doing this. The last thing you want to do is make a mistake and have no course of action to fix it.
Depending on the problem that you have with your website when you move it over to a new or different domain name I am sure that one of these solutions will help you. Databases whether they are mySQL, Microsoft or something else can be tricky and pose a range of problems. Some areas that will always save you a lot of hassle when you are working with databases are…
Creating a contingency plan – When I say “contingency plan” what I mean is creating a plan that allows you to roll back should you have any problems and need to move back to when things worked correctly on your website. This involves having a backup, any notes about customizations that you’ve done and where you’ve stored this information.
Always verifying your backups – After you’ve backed up your database just have a look at it to make sure that all your information is in there. Sometimes if you don’t you may find out later that you only have a partial database so avoid the headaches and verify the backup the first time!
Doing these two things will ensure that even if you make a mistake in doing it yourself you will have a copy of the database that is current and complete. When it comes to running your website, databases don’t need to be scary, complex or require extensive training and with the right plans in place you can run your website for years to come even after countless upgrades, revisions and integrations without major problems.













Very helpful for those apprehensive about moving a site. It’s amazing how simple it can be.
Your welcome Susan. Glad you enjoyed it!