The simple way:
You can use any WordPress migration plugin (you name it) or Softaculous (built inside cPanel). Below are the steps for Softaculous:
- cPanel > Domains > Create new domain;
- Configure the nameservers;
- - Softaculous > Export old site > 3.1 - Import the backup to the new location;
- The redirection should be auto-configured through WordPress (media path, etc). If not, see the code below about how to change the urls in the db. You can also use a plugin for this task.
- WMT > Add new site. You should also index the new sitemap.
G & 301s
For the 301 redirect, it is not a good idea to redirect all the links to the homepage (or any other page).
Here is a guide from G about what to do (even you already have the .htaccess file, inside the backup downloaded few minutes ago, it's better to save a new copy again):
Extra notes:
* When you login for the 1st time on the new domain, you should update the permalinks (Dashboard > Settings > Permalinks > Go down the page and press "Save changes".)
* If you encounter link issues (there is still the old link, instead of the new one), you should try this:
1. Identify the database name for the new installation. cPanel > Softaculous > Press the "pen" icon ("Edit Installation Details").
2. cPanel > phpMyAdmin > From the left meniu click on the database name (the one you identified above) > Press on the SQL button in the vertical menu > and paste the following code:
Code:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
3. Press "Go".
4. Clean your browser cache.
Cheers!
M