After having installed our WordPress locally with XAMPP, it is time to host it on the internet and, in this way, it is an online web page.
Next, we are going to see the steps that must be followed to have your page working on a server:
- Requirements and configuration tips on the wordpress migration.
- Preparations before installing.
- server migration Step by Step:
- File upload to hosting.
- Database configuration.
- Configuration of the new domain.
- What is needed to be able to migrate WordPress
- WordPress files and database
- Configuring local WordPress files
- Access and export of the WordPress database
- FTP configuration to the server
- Import WordPress database
- Adapting local WordPress to the online server
- Setting up the new domain in WordPress
- Setting up the new WordPress database
- WordPress migration done!
What is needed to be able to migrate WordPress
To migrate your WordPress website to an online serverbefore we need to meet several requirements:
- Have contracted a hosting service, whether free or paid (recommended). .
- You will also need to know the FTP access data to the server: IP, username and password.
- A domain, which can also be paid or free. The most common ones such as .com, .es, .net, etc. they are paid.
- have the local installation properly installed and functional ready for use. If not, you can look at our WordPress installation tutorial on Windows with XAMPP.
- Have an FTP client installed on your PC.
In addition, you will need to do certain basic configurations on the server: link the domain to the hosting directory that you will use. If you have contracted the services separately, it can be done by configuring the DNS from this to the server.
Additionally, to carry out the process in a more comfortable way, we will need a program that allows us to export and edit the database, although you can do this step with PhpMyAdmin if you prefer.
In this case, I recommend HeidiSQL, which is a free database management software with a portable version (Windows only).
As an FTP client I will use WinSCP, although you can also use FileZilla, both are highly recommended free software for Windows and can also be used as a Windows-style file explorer window.
As an extra and final point of this section, you should compress WordPress files with WinRAR or 7Zip before starting to upload the files, since by FTP the files are passed one by one and if we don’t, uploading a CMS like WordPress with hundreds and even thousands of files can become an extremely slow process.
WordPress files and database
To setup WordPress on server First we must perform two tasks:
- Compress the files of the local installation of WordPress.
- Export WordPress Database.
Configuring local WordPress files
First of all I am going to compress the WordPress files in a Zip, since, as I mentioned before, the FTP protocol sends the files one by one and, due to the large number of files that make up WordPress, the transfer can take a long time. to be done.
Once this is done, we can move on to exporting the database.
Access and export of the WordPress database
First we will have to export our database, so for this we will open HeidiSQL and we will connect to the local MySQL server turned on from XAMPP.
We open HeidiSQL and click on “New” at the bottom right and indicate the database information:
Once this is done, we will click on “Open”.
A window will now appear with all the information of the database, with the tables and their sizes. We right click on the name of the database and then on “Export database as SQL”.
Then we will put the path in which we will save the file and click on “Export”. When finished we can close this window by clicking on “Close”.
Once all this is done we will have the files ready to be uploaded to the server.
We are now done with preparing the WordPress local data. If you have compressed the WordPress directory like me, you will have to have 2 files: the SQL of the database and the ZIP that contains the web. With this ready we can start uploading everything to the server.
FTP configuration to the server
Before we can upload anything to the server, we have to configure the FTP connection, for which we will open WinSCP or FileZilla. In my case I will use WinSCP that as soon as it is opened it already shows us a panel where we will enter the necessary data to make the connection.
We will only have to fill them in and click on connect:
If you have managed to connect successfully to the server you must upload the WordPress compressed file to the folder where your domain is directed. In my case it is the folder httpdocs but in other hosting it can be called exactly the same as the domain, like srcodefuente.es.
Import WordPress database
Note: If your hosting provider does NOT allow you to remotely connect to the database, you can skip this step and import with phpmyadmin.
Now we will have to import the database to the server. To do this, we will open HeidiSQL to establish a new connection, but this time to the remote server.
In the “File” menu, we will open the Session Manager, to create the necessary connection to access the server’s database. We will click on “New” and this time we will enter the data of our hosting:
Once the connection is made, we make sure to click on the name of the database and we will click again on the File menu, then on “Load SQL file”.
Once the file with the SQL is loaded, we will click on “Execute SQL” or press F9.
Adapting local WordPress to the online server
Although we already have WordPress importing on the server, it turns out that even if you try to open the web page, it will not respond and display an error. Because? The answer is simple, the data that WordPress has configured is that of the local installation, therefore, it literally becomes “a mess”.
To achieve proper functioning, you have to edit the WordPress information in two places:
- The database in the options table.
- In the settings.php file
Setting up the new domain in WordPress
The Domain configuration in WordPress is done in the databasein this way it is achieved that it coincides with that of our server.
To do this, we will display the list of database tables and open “wp_options”, changing the “siteurl” and “home” parameters for the new WordPress domain:
Setting up the new WordPress database
Now the final step. And it is necessary to specify in the WordPress configuration at the file level for indicate which database to use. To do this, we will go to the root location of WordPress on the server, edit the “wp-config” file and put the database information in the highlighted parameters of the capture:
WordPress migration done!
After all these steps, the web page should already be accessible and usable, so all you have to do is check if the page works by typing the URL in the browser. If this is so, congratulations! You already have your new website online and open to the public!
Before saying goodbye, one last tip, check that the links in the menus, pages and other static content that you have configured in your local WordPress installation now correspond to the new domain. This way all the links will work correctly.
With all this concludes this guide, I hope you have found it useful! We would appreciate it if you share this article on your social networks or, if you have any questions or suggestions, you can leave us a comment below, thanks!