How to move the wordpress site from LocalHost to real -time server

WordPress developers usually create a website on LocalHost. This is a custody on their personal computer or notebook Local server on your computer. Compared with the real -time server, there are many advantages in local development websites, but once the site development is completed, it needs to be moved to the real -time website and openly visit.

If you are relatively unfamiliar with the development of the website, moving the WordPress website from LocalHost to the real -time website will need some additional learning. If you manually operate, the process may be very complicated and takes some time.

Although the plug -in is the simplest migration solution, if your site is particularly large or there are any conflicts between the local environment and the actual environment, you may encounter some problems. Therefore, in some cases, manual migration is still the best choice.

Five reasons for developing the WordPress website on the local host

If it takes time and errors from the LocalHost migration website, why not from the real -time server from the beginning, why not start at the beginning of the live server from the beginning. What about development?

The following is the advantage developed on LocalHost:

  1. ] It is faster. Local development is fast because there is no need to push the file to the real -time server. Instead, you can directly use the required files.
  2. It is safer. You can easily test or execute the update locally to check whether there are any errors or inappropriateness. Since you do not use the Internet connection to develop, you can avoid hacking, because there are any loopholes in the plug -in or theme you may use.
  3. You don’t need to connect to the Internet. Take a plane? Working in a place where the Internet is slow or unreliable? In this case, local development is perfect.
  4. It saves server resources. Nothing you do on the local server will not affect your real -time server.

It reduced costs. According to the website type you are building, development may take weeks or months. If you build your website on the real -time server, you (or your customers) will always pay the hosting fee. Most local development environments are free to useIt can save hundreds or thousands of dollars during the development process.

Important reminder: Even if you work locally, you should back up and use version control to avoid losing your work.

WordPress development tool used for localHost

There are several different kinds of local development. There are several different kinds of different kinds of different kinds method. The easiest way is to use applications (servers, databases, and PHP supports) that run in WordPress.

  • Local development tools suitable for Linux, Mac, and Windows
  • Local. This local development tool is specially designed for WordPress. It has some great features to assist in development, such as supporting WordPress command line interface (WP-CLI) and multiple versions of PHP, MySQL and Apache/Nginx. It can also choose to send \”real -time links\” to customers so that they can access your local site in a short time.

  • Dekinsa. Devkinsta is similar to Local, but it is a slightly immature product. If you use Kinsta hosting, it is definitely worth using.

  • Rando. LANDO is not friendly to beginners, but it is a highly customized local development environment that allows you to closely match your real -time server configuration.

xampp. XAMPP is a long -term universal PHP development stack.

  • Local development tools suitable for Mac and Windows

Server Press. Serverpress is designed for development of local WordPress websites. One of its unique features includes the ability to migrate your local site to a real -time server (if you use the high -end version of the software).

  • Local development tools suitable for Windows

Latan. Laragon is an extremely lightweight general -purpose local PHP development stack.

If you are not familiar with local development, Local may be your best choice because it has achieved proper balance between ease of use and custom. At the same time Features.

Move your WordPress website from a local host to a real -time server

There are several different ways to move the site from the local host to the real -time server. This article introduces two most common methods -manual migration and migration plug -in.

Some aspects of the migration process may be different, depending on the operating system, local development environment, real -time host and plug -in. However, these steps should be roughly similar.

Before you start

  • No matter what kind of migration process you use, you need to set some key things and the information you need: ] Virtual host WordPress requirements . If your host does not meet the requirements of WordPress, you can still migrate your website, but you may produce security vulnerabilities.
  • Link to the domain name of your network host. If your domain registrar is different from your hosting company, you need to connect your domain to your host. You can achieve this goal by changing the domain name server to your hosted company’s domain name server or changing the DNS A record to your IP address of your real -time server.
  • Login details of your host control panel. These are usually the same as the login information of your host account. If you are not sure, please consult your custody service provider.
  • Detailed information of the security file transmission protocol (SFTP) of the host account. These can usually be found in your host control panel. If you are not sure where you can find them, please consult the landlord’s support team. These are the detailed information you need:
    • host (your real -time server’s IP address)
    • Username
    • Password
    • port number
  • You also need a SFTP application to transmit the file from the local host to transmission from the local host. To the server. The following are some free and advanced SFTP tools:

]

system

Free or advanced

Winscp

Window

Application

Freedom

Filezilla

123 ]

Window, Mac, Linux

Free and advanced options

Cyber \u200b\u200bDuck

Window, mac Freedom Send

Apple Computer

High -quality

Filezilla 中的快速连接 This tutorial will be this tutorial will be Use Filezilla, but most of the SFTP client work is basically the same.

How to manually migrate your WordPress website from a local host to a real -time server The following manually moves the WordPress website from LocalHost to the real -time website. If your host uses alternatives such as Plesk or their own control panels, you should still be able to follow up.

1. Back up your local site 未知主机密钥错误窗口

The manual method of migrating your website from the local host to the real -time server is easy to make errors, and it involves quite a lot of tools. Make sure that you will back up before and every step along the way to prevent problems in case of problems.

2. Copy your file from the local host to your real -time server

] 1.

Use your selected SFTP client to log in to your web server. 左侧面板中圈出的本地站点目录 You will enter the SFTP credential provided by the host here.

Note: 右侧面板中突出显示的实时站点目录 You may receive the \”host key unknown\” error. This is not uncommon for some SFTP clients that use the first use of TOFU identity (TOFU) identity verification. If you are sure that the host key is correct, just click \”OK\” and continue. If you plan to log in to the site again through SFTP, you can even select \”Always trust this host and add this key to cache.\”

2.

Navigation to the website file on the local computer. 显示从左到右移动文件的箭头 For most SFTP software, your local file is displayed in the left pane, and your server file is displayedRight. From your local host, you should be able to access files that make up your WordPress site. If you can see the wp-config.php file next to the directory such as wp-config.php, then you come to the place.

3. navigation to the web server Public directory (right pane).

This is usually a folder called \”PUBLIC_HTML\” or \”WWW\”. This is indeed different from the host, so if you are not sure, please contact them. If you host the website in the subfolder, you need to navigate to the subfolder.

  • 4.

Select all local files from the left pane, and then drag them to the web server in the right pane.

This will take a while, depending on the number of plug -ins, themes, and files you have, but you should be able to see progress in SFTP applications.

3. Import data in the local database into real -time database

Even if you have moved the file from the local server to the real -time server, you still need to connect to Only the database can view your real -time site. At this time, when you open the browser and try to navigate to the public URL of the web server, you should see errors like \”Errors in the Database Connection\”. This tells you two things:

WordPress files have been uploaded.

The site needs to be connected to the database.

    A database from the local host

  1. An important part of the installation of WordPress is the database. This is a place where all websites are stored, such as post content, settings and meta fields.

  2. Generally, you will use PHPMYADMIN to export the database, which is almost part of all local development environments. Some local environments, such as Local, use adminer as a replacement, but the web host always uses PHPMYADMIN.

In phpmyadmin:

Select your database. Click the \”Export\” tab. Select \”Quick\” workFor the export method, select \”SQL\” as the file type, and then click \”Start\”.

In the administrator:

Select your database.

Click \”Export\” from the menu.

以绿色圈出的 MySQL 数据库按钮 Select \”SQL\” as the output, and then click \”Export\”

This will the .sql file to your computer. Read its storage position because you need to import it on the web server.

创建新的数据库页面

添加新用户

Create a database on your real -time server

to upload your database, You first need to create a new blank database on the web server. “将用户添加到数据库”屏幕

1. In your host control panel, turn to the \”database\” section, and then click \”MySQL Database\”.

带有复选框的用户权限列表

2. Create a new database. In this case, the database is called \”tutorial_mydb\”.

3. Create database users. Roll down to the \”MySQL user\” section and create a new user. As usual, you should have a unique and strong password.

4. Add the database to the user and allocate permissions. For this reason, please roll down to the \”Add the user to the database\” section, select the user and database you just created, and then click \”Add\”.

5. Allocate ownership to the user account, and then click \”Change\”.

You have now successfully created a blank database that you can import the data into it.

Edit your wp-config.php file

 

wp-config.php File is a core WordPress file that contains important information about the database. WordPress uses this file to connect to the database to retrieve and store important information, such as post content, post elements, users and various settings. You need to use the real-time server database information to update the localhost wp-config.php file so that your real-time site can communicate with your database.

1. On your local host, get a copy of the wp-config.php file and open it in the text editor you choose, such as vs code or notepad ++.

2. Transfer to the MySQL part of the configuration file and replace your LocalHost database details into the detailed information you just created.

 

// ** mysql settings -you can get this info from your web host * * ///** The name of the database for WordPress */define( ‘DB_NAME’, ‘yournewdatabasename’);/** MySQL database username */define( ‘DB_USER’, ‘yournewdatabaseuser’);/** MySQL database Password */define (‘db_password’, ‘yournewdatabasepassword’);/** mysql hostname */define (‘db_host’, ‘localhost’); DB_HOST is usually \”LocalHost\”. Although it does change on some hosts, be sure to check it. 将 wp-config 文件拖到实时站点

Some wp-config.php files also include the following:

[‘wp_siteurl’, ‘http://localhost.test’); define (‘wp_home’,, ‘wp_home’ ‘http://localHost.test’);

    If these rows exist, then you need to change them to your server URL, such as https://yourdomain.com.

  1. 3. Save this file and drag and drop it by using the SFTP client to cover you uploaded to the web server.

  2. Import your data Now you have a blank database and already point to wThe p-config.php file is time to import the data you have exported before.

PHPMyadmin on your network server. In cpanel, you will find it under the \”database\”.

Select your newly created database and click the \”Import\” tab.

Click \”Select File\” and find the SQL file you have exported before.

Click \”Start\” to start the process.

According to the size of the database, it may take some time. After completion, you should see all database tables on the left, such as wp_posts, wp_postmeta, and wp_options. 数据库中的 wp_options 表

Change the site URL in the database

Now your data has been imported. You need to ensure that the database contains a new site URL instead of the URL of the local host.

1. Open Phpmyadmin and select your database. 带有 WordPress URL 的 option_value

2. Click your WordPress option table. The table usually appears on the left.

3. After opening, you should see the first two options. Under the \”Option_name\” column, you will see \”Siteurl\” and \”Home\”.

    4. Double -click the option value under the \”Option_values\” column and change these two to your new URL. Make sure that there is no positive slope (/) in the end.

  1. 5. Open your browser and enter the URL of your real-time site at the end, and add/wp-admin/(eg, https: // yourwebsite. com/wp-admin/). From here, you should be able to log in to your WordPress dashboard. However, you may need to perform more steps to ensure that all pages and posts on your website can be accessed.

4. Refresh your permanent link

Permanent link refers to the permanent link to the pages and posts on your website and its infrastructure. Sometimes, unless you refresh your permanent link first, your post and page URL may not be able to run on the newly migrated website. You can follow the following steps:

    Turn to your WordPress dashboard and log in.

  1. Turn to settings → permanent link.

  2. Click \”Save and Change\”.

5. Search and replace in your databaseLocal host URL

Sometimes when you create your website, your LocalHost URL may also be stored in all positions in the database, which may cause links on your web server to disconnect. There are two ways to solve this problem:

Use SQL query (advanced).

Use the plug -in.

You should always create backup before performing any operation of the database.

 

Use SQL query for search and replacement

This method is greater than using plug -in, but if you are confident in SQL, then it is fast and simple, and you do not need to install any plug -in. Essence

    1. Log in to PHPMYADMIN on your web server, select your database, and then click the \”SQL\” tab.

  • 2. Copy the following query parameters and paste it into the SQL query field:

  • update wp_posts set post_content \u003d replace (post_content, ‘http://localHost.test.test ‘,’ https://webserver.com ‘); update wp_postmeta set meta_value \u003d replace (meta_value,’ http://localHost.test’: //webserver.com ‘);

PHPMyAdmin 中的 SQL 查询

123] You need to modify some of the values \u200b\u200bin this query: 查询中的匹配行

\u0026#39; wp_posts \u0026#39; and \u0026#39; wp_postmeta \u0026#39; What is the database prefix. You can see this in the left pane of PHPMYADMIN.

URL needs to be changed to your actual value.

After modifying the query, please check it to ensure the correct value, and then click \”Simulation Inquiry\”. \”Simulation Inquiry\” will perform a test to see how much value it will change if you actually run. If there is an error at this time, check your value carefully.

  1. After running the simulation, you should see some \”matching lines\” numbers. This is how many examples will be replaced. If this is zero, then you may use incorrect URLs, or there is really nothing to replace. If your urlThere is no need to make any further changes.

  2. 3. If your simulation query shows many matching rows, turn off the \”Simulation Inquiry\” dialog box and click \”Start\” to run the actual SQL query. You should be able to navigate to your real -time website now.

  3. Use plug -in search and replacement

  4. If you haven’t used SQL before, this method is slightly easier and not errors. This example uses the Better Search Replace plugin.

  5. In your WordPress dashboard:

  6. Turn to plug -in → add new.
  7. Search \”better search replacement\”.
  8. Click \”Install immediately\” on the Better Search Replace plugin.
  9. Click \”activation\”.
  10. In your WordPress dashboard, turn to tools → better search and replacement.
  11. Use your local host URL (eg, http://localHost.test) to fill in the \”Search\” field.
  12. Use your network server URL (eg, https://yourwordPressWebsite.org) to fill in the \”replacement\” field.

Select the database table to execute the search/replacement. Usually you only need to apply it to WP_Posts and WP_Postmeta tables.

Maintain \”not distinguishment\” and \”replacement GUID\” without selection.

Select \”Run in a trial operation?\”.

Click \”Run Search/Replace\”. Trial operation means that this will not make any changes, but it will show the number of potential changes.

Check the change. At this point, you should see some changes. If you don’t do this, then you may need to check your website carefully. If your URL is correct and there is still nothing to change, then you do not need to continue and delete the plug -in.

If you want to make a lot of changes, please cancel the selection \”Run in the trial operation?\” Options and click \”Run Search/Replace\”.

Disable and uninstall Better Search Replace. Complete this operation and you have checked whether the site is working properly (especially checking the image when closing the local host), and then you can stop and uninstall the plug -in.

You have completed manual migration now!

Use the plug -in to migrate from the local host to the real -time server When using plug -in migration WordPress website, if your website is large or there is a problem with the server environment, the migration may fail. The plug -in may not provide you with any feedback. In these cases, manual migration may still be needed.

However, for most websites, it is easier to migrate using plugins, less time, and less errors. This section introduces your site with Duplicator plug -in, but other options include DesktopServer and Transferito. No matter which plugin you use, the process should be similar.

1. Create a package 包设置步骤

1. In your WordPress dashboard, turn to plug -in → add new.

2. Search \”Coper\”. Click installation → activation.

3. Find the \”Copter\” in your WordPress management menu. Click \”Bag\” to enter the \”bag\” screen.

4. Create a new package.

现场测试结果,全部标注“好” You should see a message saying \”No Bags found\” on it. Click \”New\” in the upper right corner of the screen.

5. Check the package settings. At this point, you can change some options, but in most cases, default settings can be. Click Next \u0026#39;.

View the test scan and change it if necessary. The plug -in will now scan your site to ensure that everything is normal before backup. The inspection here attempts to ensure that the software package is compatible with most hosting environment. After completion, you will see the results of these tests.

下载包文件框有两个选项 Your test results should be \”good\” -except for size check. If you have a considerable website, you may receive \”notifications\” about size inspection. Sites with larger compression on some budget hosts may cause timeout, although this is usually not a problem. Despite this notice, you can continue.

If you have any problems, you only need to click the project to obtain more details and suggestions on how to correct the problem, and then continue.

Build your bag. Once your test results are \”good\” (except for size inspection notification), click the \”Construction\” button. This may take a while, depending on the size of your website, but please wait patiently and keep the browser window open until it is completed.

your file. After completion, you need to two files: a ZIP file containing website files and an Installer.php file.

cpanel 中的 MySQL 数据库选项

2. Create a database on your real -time server

创建新数据库选项 To install your software package, you need to create a new blank database on the web server. Log in to your host control panel, turn to the \”MySQL database\” section, and create a new database.

Create a database on your real -time server

To upload your database, you first need to create a new blank database on the web server. 添加新用户

1. In your host control panel, turn to the \”database\” section, and then click \”MySQL Database\”.

向数据库添加新用户

2. Create a new database. In this case, the database is called \”tutorial_mydb\”.

为新用户分配权限

3. Create a user for the database. Roll down to the \”MySQL user\” section and create a new user. As usual, you should set a unique and strong password for the database user.

4. Add the database to the user and allocate permissions. For this reason, please roll down to the \”Add the user to the database\” section, select the user and database you just created, and then click \”Add\”.

FileZilla 中的快速连接按钮 5. Allocate ownership to the user account, and then click \”Change\”.

3. Copy your file from localhost to your real -time server 未知主机密钥消息

to copy the file from Localhost to the real -time environment. You need And Installer.php files on the web server.

For this part, you need a SFTP client and your SFTP login details. If you are not sure what these are, be sure to ask your online host. Or, since you only upload two files, you can upload them through the host control panel file resource manager (if so).

LocalSitePackage 和 Installer.php 文件 1. Use your selected SFTP client to log in to your web server.

yourlivesite 在文件中圈出

Note: You may receive the error of \”host key\”. This is not uncommon for some SFTP clients that use the first use of TOFU identity (TOFU) identity verification. If you are sure that the host key is correct, just click \”OK\” and continue. If you plan to log in to the site again through SFTP, you can evenSelect the \”always trust this host and add this key to the cache.\”

带有指向右侧面板的箭头的安装文件

2. Navigation to the location of the duplicator package and Installer.php file on your local computer. In most SFTP software, your local file is displayed in the left pane, and your server file is displayed on the right.

3. Public directory (right pane) navigation to the web server. This is usually a folder called \”PUBLIC_HTML\” or \”WWW\”. This is indeed different from the host, so if you are not sure, please contact them. If you host the website in the subfolder, you need to navigate to the subfolder.

6. Select your replicator package and Installer.php file and drag them to your web server (move from left to right). This may take some time, depending on the size of the copy machine.

第 1 步(共 4 步):部署

4. Install your duplicator package

1. In your browser, transfer to https://yoururl.com/ Installer.php

2. Step 1 (4 steps in total): deployment

. In the URL above, you should now see the first step in the deployment process. Check this step to check whether your host is suitable for duplicator to install your software package. If you encounter any failure at this stage, contact your network hosting service provider. There are some options here, but most of the time, the default value is fine. If everything goes well, click \”Next\”.

Now you will extract your Duplicator software package. This may take a little time, depending on its size.

要求和通知 3.

Step 2 (4 steps in total): Install the database

. After decompression, the system will ask you to provide database information. Enter detailed information from the database you created before. The default is to delete any information that exists in the database. If you create a blank database according to the suggestion, this is not a problem.

Although this is a real -time web server, your host may still be set to \”LocalHost\”. This sometimes changes between hosting service providersSo if you encounter any problems, please contact you.

Once again, there are some options, but in most cases, the default settings will be perfect. Click \”Test the Database\”. 第 3 步(共 4 步):更新数据

If you pass, it means that duplicator can successfully connect to your database. Click Next. \u0026#39; If you have any errors here, please check the detailed information you enter carefully. If you cannot solve it yourself, please contact your hosting service provider.

Now you will install your database. This process is usually much faster than the decompression package, but it may still take a few minutes, depending on the size of the database. 第 4 步(共 4 步):测试站点

4. Step 3 (4 steps in total): Update data. Now your database has been installed, and you will be asked to provide your website title, new URL, and the path that should be installed on the server. Duplicator will try to fill in these details automatically, but it is worth checking out whether they are correct. After confirming that the information is correct, click \”Next\”.

5.

    Step 4 (4 steps in total): Test location.

  1. Your website should be online now. You can click the \”Administrator Login\” link. Be sure to select \”Automatically delete the installation program file after logging in\”.
  2. 6.

Delete the installation program file.

After logging in to the WordPress dashboard, if you select the \”Automatically Delete the Installation Program File\” check box, your installation program file will be automatically deleted. If you forget to check it, you can still use SFTP to delete files manually. If you don’t intend to use the duplicator plug -in in the short term, it is best to stop and delete it. If you need it again, you can reinstall it at any time.

5. Refresh your permanent link

Permanent link refers to the permanent link to the pages and posts on your website and its infrastructure. Sometimes, unless you refresh the permanent link first, your post/page URL will not be able to run on the new migration site. This is a simple process:

  • Go to your WordPress dashboard and log in.
  • Turn to settings → permanent link.
  • Click \”Save and Change\”.
  • Test whether your real -time site has an error

No matter which method you use to migrate your website from localhost processNo problem occurred. After migrating your website from LocalHost to Live, you need to check the following points:

    The front end of:

  • The front end of the website looks like expected?
  • Are all links effective?
  • Are all interactive elements working normally (such as slider, accordion, pop -up window)?
  • Can any form be submitted? Will these forms receive it?

WordPress instrument board:

Are all the management pages correctly loaded?

Can you add and edit posts, pages, and any custom post types?

Can your website be included in the search engine? Turn to settings → read and ensure that the \”stop search engine to index this site\” is not selected.

Is your plug -in and theme page valid?

Can I install new plug -ins?

Backup

Now your website is already online, you should make sure you set regular backup. Due to hackers, updates or changes, you never know when you will make mistakes. Jetpack backup makes all this simple.

Using Jetpack Backup, you can save all files, including databases. The redundant copy is made on multiple servers and stored in the clouds in different places, thereby eliminating additional loads of the server. Jetpack Backup is tested to ensure that there is no conflict with the main plug -in or host, so it can be used almost safely on any website. Learn more information about the BORDPRESS website backup.

Check your speed You will not use the content delivery network (CDN) or cache on the local host, but once your website is online, you may find that the speed performance of the website is different. Essence The implementation of a certain type of cache and/or CDN are essential to accelerate the loading time of most websites. Jetpack CDN can meet all your speed needs. The most important thing is that it is free. It optimizes images and static files, such as CSS and JavaScript, and deliver them from Jetpack’s global server network. Without file restrictions, it also applies to Jetpack’s advertising video hosting service VideoPress. Migration from local hosting to your real -time site We introduced you to the method of migrating WordPress website from local hosting to real -time servers -manual migration and use of plug -in migration Essence AlthoughThe manual method looks quite challenging, especially for new developers, but in comparison, the plug -in method makes migration easier. For most people, the use of migration plugins will be the fastest, simplest, and most error -free way to make the website go online.If the plug -in method does not work for you, then you can always choose the backup option of the manual mobile website.No matter what kind of migration method you choose, you should make sure you back up at every step.

Author:

Leave a Reply

Your email address will not be published. Required fields are marked *