This article covers topic of migrating your existing website to host it under new domain. For example, you had your website hosted under some free domain (i.e.
mike.freedomains.gulp.co.cc) and now you have grown enough to migrate it under your own domain (i.e.
mikerules.com). Here you’ll find steps required to perform this migration as painfully as possible.
Note, that we’re talking about migrating website to a new domain. This article does not cover topic of migrating domain from one domain registrar to another, as this is whole different story.
Copy files to new domain
Copy files from FTP server / account / folder responsible for hosting your old domain to relevant server / account / folder, that is responsible for hosting your new domain.
If your FTP client supports such operation (unlikely), you can perform direct FTP-to-FTP copy process. In all other cases you must first copy (download) files from “old” FTP server to your local computer and then copy (upload) them to “new” FTP server.
If you’re using Git and both servers are supporting it, then this process can be even easier. I assume, that if you do are Git, then you’re enough experienced and do not require any additional information on this.
Skip this step, if you’re website is not using database at all or if it using an external database server, that will not be migrated.
There is a various way on which you can perform database dump on “old” server and database upload on “new” one:
- directly dump and upload database using console or application like phpMyAdmin or Adminer,
- use backup/restore tools provided in your domain configuration panel (like in cPanel or DirectAdmin),
- use tools in your website or CMS, if they’re any (like for example backup/restore tools in WordPress),
- use some plugin, 3rd party software or external service.
Once dump on “old” server is completed, use the same or similar solution to upload database content to “new” server.
You’re not going to overwrite anything (you’re just migrating files and database content from one place to another), but since you most likely downloaded both files and database dump to your local computer, then it might by a good idea to store them as backup of your website, in case anything happens at some point later.
Always remember about performing regular website dumps, no matter, if you’re migrating or changing something or not. Nasty times have come and weird things like to happen.
Sign migration in .htaccess
Login again to “old” FTP server and in root folder of your “old” website edit (i.e. download, edit locally and upload changed version — in most cases) or create new
.htaccess file. Include following content inside:
RewriteEngine On RewriteRule ^(.*)$ http://mikerules.com/$1 [R=301,L]
Consult manual of your server software, if you’re not using Apache server and can’t make use of
.htaccess file-based redirection.
This step is extremely important, if your website has some traffic and audience and you don’t want your current users / readers to hit the white page instead of your website.
Google Webmasters Tools
Finally, login to Google Webmasters Tools to provide new domain / URL address and other information for your website, that maybe cached in Google.
This step is also very important, if your website has some traffic and audience, especially when most of these audience comes from Google search engine.