WordPress moving tutorial: how to change the domain name for website transfer space?

WordPressMoving tutorial: how to change the domain name for website transfer space?

due toChen WeiliangSensitive words (names of Chinese state leaders) appeared on one of the responsible websites, but unexpectedly, they were blocked and cannot be accessed in mainland China.

Observation found that there are a lot of legitimate foreign websites, because of the appearance of sensitive words, they are blocked by the Chinese network firewall, so no matter what we donew mediaOrE-commerceWhen operating a website, you must pay special attention to whether the website has sensitive words, and use technology to filter sensitive words to reduce the risk of being blocked.

How to detect whether a website domain name is blocked?You can refer to this article:'What should I do if the website domain name IP is blocked?Firewall of China detection query"

This article summarizes the WordPress moving and changing domain name tutorials. Generally speaking, the steps for website moving are as follows:

  • XNUMX. Backup blog website files and databases;
  • XNUMX. Transfer the website files to the new space, and import the database in the new space;
  • XNUMX. Modify the website configuration and database;
  • XNUMX. Change a new domain name;
  • XNUMX. Check the transfer results.

There are 3 situations in which WordPress website moves

  • 1. Change the space, not the domain name
  • 2. Change the domain name without changing the space
  • 3. Change the domain name, also change the space

XNUMX. Backup blog website files and databases

1) Download and backup the blog file in the original space:

  • If the original space supports online decompression, it is recommended to pack and download, so that the download size becomes smaller and time will be saved a lot.
  • (I basically use FTP to synchronize and backup to the local if I have any article updates. It is best for everyone to have this habit, otherwise the sudden accident will make you regret it!)

2) Backup the database:

  • able to passphpMyAdmin, Empire Backup King, or a database backup plug-in like WP-DBManager, you can choose a method that you are familiar with.

 

More WordPress website moving tutorials▼

XNUMX. Upload the blog file and import the database

1) Use FTP to transfer the blog files to the new space, just like downloading, if the new space supports online decompression, it is recommended to package and upload, which saves a lot of time and traffic.

  • Usually the WordPress directory is under public_html/, so just upload the files in the public_html/ directory to the public_html/ of the new host.

2) Import database: PHPMyAdmin, Empire Backup King can do it.

  • You need to create a database in the new host, and then import the database you exported earlier.

3) Use via SSH MySQL Database Import Command ▼

XNUMX. Modify the website configuration and database (key)

1) Modify the wp-config file, it is best not to use Notepad to modify it, use an editor such as notepad++ or UltraEdit, and put theMySQL databaseThe information is changed to the database information of your new space, as follows:

/** WordPress 数据库的名称 */

define('DB_NAME', '你的新空间数据库名称');

/** MySQL 数据库用户名 */

define('DB_USER', '你的数据库用户名');

/** MySQL 数据库密码 */

define('DB_PASSWORD', '你的数据库登录密码');

/** MySQL 主机 */

define('DB_HOST', '你的数据库地址');

Fill in the database name, database username and password of your new host space.Note that the MySQL host is 'localhost' by default. If you are a Windows host, do not modify it. If it isLinuxHost, you may need to fill in the address of the database.

2) Enter phpMyAdmin in the new space to modify the database: modify the values ​​of the "siteurl" and "home" fields in the database table wp_options and change them to your new domain name address;

3) Log in to the domain name server (for example: DNSPOD), and resolve the domain name to the IP address of the new space.

4) Log in to the hosting control panel and add a domain name.

Replace the server path and domain name

Install WP Migrate DB plugin ▼

  • Suitable for website moving (can replace the server path)
  • Replace keywords with your database and export as MySQL database
  • Use the "Find & Replace" function to quickly replace the server path and domain name

phpMyAdmin modify server path and domain name

  • if you useWP Migrate DBPlugin that exports a MySQL database file with the server path and domain name replaced.
  • Just in phpMyAdmin, click your database name → click "Import" to import it directly (you can easily skip the replacement steps below).

first step:In phpMyAdmin, click the name of the database you want to modify.

The second step:Then, click Search.

third step:Search old paths

  • Replace the old web space path (folder address) with the new path
  • Old folder path: /home/abc/public_html/site/etUFO.org /
  • New folder path: /data/abc/etUFO.org /

the fourth step:Search old domains

Old domain name: http://www.ufo.org.in 

New domain name:http://www.etufo.org

phpMyAdmin search keyword No. 6

Find the search results as shown below:

phpMyAdmin search result No. 7

  • There are links or pictures in the original article, and the addresses of the previous domain names are used, so those addresses need to be modified.

the fifth step: Left-click "Browse";

In this way, when the new window is opened, the lower part will automatically jump to the field position (automatic filtering, showing which field the keyword is in).

Note: The website space path (folder address) should also be replaced. Please search and replace by yourself according to your own situation.

For example, in phpMyAdmin, execute the following statement:

UPDATE wp_options SET option_value = REPLACE(option_value,'旧地址','新地址');

UPDATE wp_posts SET post_content = replace (post_content,'旧地址','新地址');

UPDATE wp_posts SET post_excerpt = replace (post_excerpt,'旧地址','新地址');

UPDATE wp_posts SET guid = replace (guid, '旧地址','新地址');

SQL statement description:UPDATE data table name SET field = replace (field, 'old address', 'new address');

Fourth, change the new domain name

If you need to change a new domain name, please follow it. If you do not change the domain name, please skip this step.

  • The original domain name is 301 redirected to the new domain name → change the database content.

Do a 301 redirect:

  • The purpose of 301 redirection is to make the content indexed by the original search engine turn to the new domain name. There are many ways to achieve it.

If you are using a Linux+Apache host, you can choose to modify the .htaccess file and insert the following code in this file:

RewriteEngine on
RewriteCond %{HTTP_HOST} www.ufo.org.in
RewriteRule ^(.*) https://www.etufo.org/$1 [L,R=301]

As above, the old domain name is http://www.ufo.org.in, the new domain name is http://www.etufo.org

Or, if your user is a Windows host (not recommended, because the Windows host is fully compatible with WordPress), you can choose to modify the wp-blog-header.php in the root directory of the WordPress blog, in

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

XNUMX. Check the transfer results

Take a moment and check the website front desk for errors?

  1. Check the website background plug-ins and theme settings one by one, which can reduce various losses caused by errors on your website.
  2. For example, some data of the keywordlink automatic anchor text plug-in will be automatically cleared, and only the previously backed up keywordlink automatic anchor text plug-in will be imported.

After the WordPress website moved and changed the domain name, there really was a problem, I don’t know how to solve it, what should I do?

  • referenceChen WeiliangThe WP moving tutorial shared by the blog is still unsolvable. It is recommended to put your problem on the search engine search, so that the problems you encounter such as moving your WordPress website and changing the domain name can usually be solved easily.

Follow the instructions above and you will be able to move successfully in no time!

Congratulations, your WordPress site has been transferred successfully!

Extended reading:

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "WordPress moving tutorial: how to change the domain name for website transfer space? , to help you.

Welcome to share the link of this article:https://www.chenweiliang.com/cwl-528.html

Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!

🔔 Be the first to get the valuable "ChatGPT Content Marketing AI Tool Usage Guide" in the channel top directory! 🌟
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!

 

Comment

Your email address will not be published. Required fields * Callout

scroll to top