Migrating Wordpress site to new domain

2020-05-09 17:49发布

问题:

I have a Wordpress site with hostagator web hosting , I am buying new domain and want to use new domain for site but same existing developed site. How to backup existing site and then restore to new domain ?

回答1:

Solution is here

after searching a lot i got one simple solution. Using Duplicator plugins or any other tool is either difficult or paid.

My simple solution is as follows

  1. Backup and download all data from public html folder
  2. Download the SQL database associated with the wordpress site.(in phpMyadmin you will find option of export database.)
  3. Now upload the same files of public html folder to the public html folder of new hosting.
  4. create a database with same name and import the tables from the downloaded SQL database.(in phpMyadmin you will find option of import.)

  5. Now check the site if the domain is not changed

If you are changing domain name too by keeping the website same you need to follow few more steps

Download and place the interconnet/it tool in public html folder and follow the steps in documentation to use this tool.

case1- you are transferring site from one domain to another

if you are transferring from abc.com to xyz.com ins search and replace tool replace abc.com string with xyz.com .

case2- if you are changing the names only in website

if you are keeping the domain same but changing name of site e.g. ABC Technologies to XYZ technologies . Then replace ABC to XYZ

You can use this tool as per your need as it is applicable for database too.



回答2:

There are a lot of ways of doing that. You can search a lot of materials on Internet but I would advise you to use this tool because I used in the past and it's reliable and very straightforward.

It is called Duplicator and is a wordpress plugin solution: https://wordpress.org/plugins/duplicator/

Consider to maintain your site active until your new site is working properly. I hope I could help you. Regards.



回答3:

Just install WP migrate db plug-in in your current website. And export the database with your new URL. Then create a new database in your server and import the updated SQL file. Then edit your config.php with new database details. Finally point your new domian to this server **should take complete backup (both files and databse) before making the above changes **



回答4:

Here I will explain how to take back up manually and restore manually on another server with other domain name. Backup: You need to take back up of site and database.

For site, you can take only back up of wp-content. It contains all data you need to resore. STEP1 : cpanel-file manager-public html- (wp-content)- compress & save- export or download zip file. For database: phpmyadmin -> export databse. This gives you localhost.sql file.

These two files one .zip file and another .sql file are your back up. (It is good to remember user id password of wordpress dashboard of this one)

Restore in another server on another domain:

After you get you new domain dns propagated on new server, open its cpanel. Run wordpress script , see database name it is creating. 1) database restore: MyphpAdmin->Database created by wordpress->check all tables->drop all tables. Now your database is clean without any table.

In your loacalhost.sql file remove two piece of codes: a)any signature like this (it should be on top) -- phpMyAdmin SQL Dump -- version 4.8.5

-- https://www.phpmyadmin.net/

-- Host: localhost:3306 -- Generation Time: Oct 14, 2019 at 09:45 PM -- Server version: 5.6.45 -- PHP Version: 7.2.7

b) Code prompting creating a new database like this:

-- Database: soniasin_fitfoody

CREATE DATABASE IF NOT EXISTS soniasin_fitfoody DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE soniasin_fitfoody;

-->Now, go to import and import, select your back up .sql file-> go. It will import all tables in your this database. --> There is a database table now like wp_option, go there & edit siteurl (keep your new domain name), home (keep your new domain name) and admin email id.Very important. Site Restoration:

1) Go to public html folder. Remove directory wp-content. 2) Import your back .zip file here and unzip. 3) You will find on wp-config.php file in public html folder, open it and update table prefix. $table_prefix = 'wp_'; Here yo have to see what is your table prefix. Check database tables and see what prefix is in all tables. Here in this example it was 'wp_' , therefore kept it. 4) Now log in to you wordpress dashboard. It will take username of old site now and should take old password too. In case you forget password, change it and then open. Now wordpress will confirm that your database is changed, say ok and proceed. Your site should be running on new URL now on another server.

In case of doubt, you ask me. If one want to watch any video here goes the link https://youtu.be/wROa37k_RQA.