Starting your WordPress website can seem a bit intimidating. Luckily, you can try building a website on your local drive for practice. It gives you a safe environment for experimentation and learning. You can spend as much time as you need to tweak it the way you want to. In this article, you’ll learn how to make a WordPress site live.
Why Should You Migrate Your Site?
Experimenting on a live site has its drawbacks. First of all, you need to pay for web hosting while you do it. Furthermore, if issues arise and your website crashes, that can harm your SEO and brand reputation.
On a local site, you can do anything you want without the fear of impacting your visitor’s experience. Once you have fully developed your website, you can bring it online by moving it to a live server.
How to Make a WordPress Site Live?
If you have sufficient technical skills, you can try transferring your site manually. Alternatively, you can also use the export/import feature on WordPress or use a plugin.
Transferring Your Site Manually
We assume you already have a website created on your computer. If that’s the case, follow the instructions below. For this tutorial, we’ll be using Hostinger’s hPanel.
- Export your local site’s database. Go to your browser and paste the following in the address bar:
This will open phpMyAdmin where you can select your website’s database, and export it. Select the Quick export method and make sure to save the database as a .sql file.
- Create a new MySQL database. Here you’ll have to create a new database for your site from your hosting account’s control panel. Find the database section and click MySQL Databases. Enter the name and password of the database, then click Create. The database you just created will be added to the list. Click Enter phpMyAdmin next to the database you just created.
- Import the previously exported database to the server. Once you’re inside phpMyAdmin, import the database that you downloaded before. Click Import and Choose File. Select your database and click Go.
- Change your site’s URL. Once the files are uploaded, and the database is created, you need to connect the website to your domain. In phpMyAdmin, click wp_options and click Edit the siteurl option by entering your domain name.
Once you’re done, do the same for the home option.
- Change the database details in the wp-config.php file. You can’t access your site just yet, because the database details on your configuration file haven’t been updated. Go back to your hPanel’s File Manager and edit the wp-config.php file. Swap the username, password, and database name with the ones you created earlier. Click Save & Close once you’re done.
ProTip! You can perform this through an FTP client like FileZilla as well.
- Make sure that your links are updated. Go to your WordPress dashboard and navigate to Settings -> General. Make sure that both your WordPress address and site address fields direct to your domain name. Then click Save Changes. Now, go to Settings -> Permalinks and click Save Changes.
- Update link and image paths. Your WordPress website is live at this point. However, links for articles and images may not be working. You can easily fix this by adding a SQL query to your database. First, go to phpMyAdmin, select your database, and click SQL on the menu bar. Then, insert this SQL query:
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/testingsitewordpress/', 'www.hostinger-dev-7.xyz/');
Note: Don’t forget to replace the local site <localhost/testingsitewordpress> and the live site <www.hostinger-dev-7.xyz> with your own site’s info. Make sure to save the changes once you’re done.
Using Export/Import Feature on WordPress
For this method, you should prepare a second WordPress installation on your hosting. Then, you can use the export feature on your local site and import it to the one you create on your hosting.
It’s certainly a much easier and faster method to transfer your site before making your WordPress site live. However, this method is only for moving posts, pages, menus, comments, categories, authors, and media files. In other words, you’ll need to re-install the plugins and themes you have on your local site.
Make sure the second WordPress installation has no content yet. If it has the same articles from your local site, the migration process won’t overwrite them. Instead, it will display the “Post already exists” error message.
Let’s start moving your site to its new home:
- Export the content from your local website. On the WordPress dashboard of your local site, go to Tools -> Export. Select the type(s) of content you want to export and click Download Export File. Save the .xml file on your local drive.
- Install the WordPress importer. From the dashboard, head over to Tools -> Import. Here you should see a list of platforms that you can import your content from. Click Install Now under the WordPress section and wait until the installation finishes. Then, click Run Importer.
- Import the downloaded .xml file. Click on Choose File and select the .xml file you exported earlier. Then, click Upload file and import.
- Re-assign the authors. You can create a new user and assign it to all of your content or select an existing author from the list then. Then, if you wish to import media files, tick Download, and Import File Attachments. Finally, click Submit.
Once you’re done importing content, you can start customizing your site’s appearance, re-ordering menus, installing plugins, etc.
Transfer the Site Using a Plugin
If you wish to fully move your local WordPress site to a live server, why not make a complete clone copy of your website?
We’ll use a plugin named Duplicator – it’s one of the most popular migration tools that allow creating a full copy of your WordPress site and import it to your hosting.
- Install the Duplicator plugin. You can easily do this from the WordPress dashboard’s Plugin section.
- Create a new package. Go to Duplicator -> Package and click Create New. Wait until the scanning process is finished. Click Next to go to the download page.
- Download the package and the installer.php file. You can do so by choosing the one-click download option. Basically, the package file is similar to the .xml file used in the previous method. It contains all the data of your site: content, themes, plugins, etc. The installer.php file serves as the interface for “importing” a package file to your live site.
- Create a new MySQL database. Similar to the first method, you need to create a new database through your control panel. Find the MySQL Databases under the database section. Fill in the details (name and password of the database) and then, click Create.
- Upload the package and the installer.php file to your hosting. Next, open your FTP client and log in to your account. If there’s a WordPress installation folder in the root folder (domain/your-domain-name/public_html), empty it. You’ll be installing the package from scratch. There should only be two files in there:
- Access the Duplicator installer script. Now, you need to access the installer script by going to yourdomain.com/installer.php. If all the indicators are green, click Next to proceed.
- Install the database. Fill in the details of your database (host, database name, username, and password). You can check the details in the MySQL Database menu. As for the host, fill it with localhost. Click on Test Database to ensure the credentials you entered are correct. If you passed the test, click Next to continue.
- Update your data. In this step, the installer will ask you to update the domain name and the path of the WordPress installation folder. However, if both are entered correctly, you can click Next right away.
- Test your WordPress site. That’s it! At this point, your WordPress site is ready to use and looks just like your local site. Select Admin login to access your dashboard.
Note: You should leave the auto delete installer box checked. If not, someone else might be able to access http://yoursite.com/installer.php and easily overwrite your WordPress installation.
Now that you know how to make a WordPress site live, you’re free to experiment with the local version without worrying about downtime or breaking your site. When you’re done tweaking, you can migrate it to a live server to rack up traffic.
In summary, let’s take a quick look at the three methods you can use to launch a WordPress site live:
- Manually transfer your website. You need to export your local site’s database, import it to your live MySQL database, upload all the WordPress installation files to your hosting via FTP or File Manager, and perform any necessary configurations.
- Import and export feature. Besides your local site, you need to install WordPress on your hosting. Then, go to the Export menu on the local site’s dashboard, save the .xml file, and import it to the live WordPress site.
- Use a plugin to move your site. Install Duplicator on your local WordPress site, create a package, upload it to your hosting along with the installer script. Then, go to yourdomain.com/installer.php to import the package.
Depending on your technical skill, you’re free to choose which method suits you the most. So, if you are still unsure of how to make your WordPress site live, let us know in the comments.