WordPress Website Migration Guidance for SEO

wordpress migration tutorials

It's absolutely nice journey to work with wordpress for it's super friendly and powerful design. But some day you found your wordpress site needs better support and have to move to new server space, you might be not sure to begin with. This article guides you step by step on how to migrate a wordpress site to new space for different situations. You should be able to handle any type wordpress site migration by following our guidance.

Wordpress migration without domain change

This should be the most popular migration where we just need to move existing site to new server space. Following are full steps of the process. Here we take cpanel account for example, other control panel softwares provide similar features.

1. Login to your cpanel center and navigate to your wordpress installation directory. If its your primary site, it's normally located under "Public_html" which is the root directory.

2. Select all files/folders on top navigation bar and right click anywhere on file list then select "Compress". By default it will take the first folder name for the compressed file. You can leave it as it is or just give it a good name you can easily remember. Once compression done, right click on the file name and choose download to save it on your computer drive.

file compression

3. Now, let's go ahead to backup your wordpress database. Go back to cpanel home and navigate to "Database" section then choose "phpMyAdmin". Now you're redirected to phpmyadmin panel. Click on the database which your wordpress site is using. You probably not sure which database it is if there're multiple ones, especially when you installed the wordpress site via auto installers like softaculous. For this case, just go back to your file wordpress installation directory and open the file "wp-config.php", there's a line "DB_NAME", your database name is placed there.

4. Select all tables then choose "Export" from the dropdown list in the bottom page. It will give you two options, quick and custom. Leave it as default and click "Go" button. It will prompt up a window for downloading. That's your database file, click save to save it on your computer.

mysql export from phpmyadmin

Now, you have get full backup of your wordpress website files and mysql database. We need to put it online from your new server space. So here're detailed steps

1. Upload the compressed file to your new server space via new ftp credentials(be sure to upload to the exact directory where you would like to put up the wordpress site). Navigate to file manager and locate the file we just uploaded, then right click on the file and choose "Extract". It will ask where you like to extract all files to. By default it will unzip to current directory, if you would like to put under other directories, just specify the path then press "Extract File(s)" to proceed.

extract files in cpanel

2. Now, navigate to control panel "Database" section and click the "MySQL Databases" icon. Under create new database section, fill out your desired database name to create a new database. Scroll down to create a user/password then assign it to your database.

3. Go back to control panel Database section and click "phpMyAdmin", Click the database we just created. Click the "Import" icon from top navigation bar and it will bring us to import wizard. On the new page, click "browse" to choose the database backup file we just saved then click "Go" to have all data uploaded. Wait some time for the wizard to complete.(Note: if your have a large size database, you can upload the file to file manager directory then contact hosting support to import because it will be timed out easily on customer end)

Now you have restored everything to new server space. Bypass DNS as we suggested from previous article and test if everything working properly. If yes, find a good time to change over DNS servers. If not, fix everything before you make the change.

UPDATE: we can use following sql queries to replace everything in short time other than do it manually.

UPDATE wp_posts SET post_content = replace( post_content, 'old.com','new.com');
UPDATE wp_comments SET comment_content = replace(comment_content, 'old.com', 'new.com');
UPDATE wp_comments SET comment_author_url = replace(comment_author_url, 'old.com', 'new.com');
UPDATE wp_posts SET guid = replace( guid, 'old.com','new.com');

Wordpress migration with domain change

To many people, website means business. If our site is alreayd crawled by search engines with good traffic, of course we want to drive the traffic to new site. It's big pain to let search bots to crawl our new domain from scratch. For this purpose, we need to configure 301 redirects from all old urls to new site. In .htaccess file, we need to change to following:

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
rewritecond %{http_host} ^www.old.com [nc]
rewriterule ^(.*)$ http://www.new.com/$1 [L,R=301]
</IfModule>
# END WordPress

If our server is windows based, we need to add following to wp-blog-header.php from website root(after the first <?php sign)

if (strtolower($_SERVER[‘SERVER_NAME’])!='newsite.com')
{
$URIRedirect=$_SERVER[‘REQUEST_URI’];
if(strtolower($URIRedirect)=="/index.php")
{
$URIRedirect="/";
}
header('HTTP/1.1 301 Moved Permanently');
header('Location:http://newsite.com'.$URIRedirect);
exit();
}

Now, your old site URLs will be redirected to new URLs and business will keep alive!

About the Author
Kenny
Kenny is owner of webhostpark and has been working in hosting industry since 2006. We provide unbiased hosting reviews and release the latest promo news. Follow me on Google plus

Leave a Reply

What is 3 + 15 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

This site uses Akismet to reduce spam. Learn how your comment data is processed.