Backups and migrations
Move a locally developed WordPress site to your hosting
It's common to build a website on your computer (with XAMPP, MAMP, Local, Laragon…) and, once it's finished, get it running on the hosting. The process is simple if you bear in mind that the website has two parts: the files and the database. You need to upload both and then tell WordPress where the new database is and what its final domain is.
If the website isn't on your computer but on another hosting, you're better off following the guide to migrate WordPress to another hosting.
1. Upload the files
If the website is the account's main domain, the files go in the public_html folder. If it's an addon domain, upload them to the folder assigned to that domain (you can see it in cPanel > Domains).
There are two ways to upload them:
- Over FTP: connect with a client such as FileZilla using your FTP login details and copy all the WordPress files and folders from your computer to
public_html. - With cPanel's File Manager: it's much faster to compress the whole of WordPress into a zip, upload it in one go and extract it there. When you extract it, check that
wp-config.php,wp-admin,wp-content, etc. end up directly insidepublic_htmland not in a subfolder. Then delete the zip.
2. Create the database
Create the database and its user with cPanel's MySQL Database Wizard. Note down the database name, the user and the password, and in the privileges step tick ALL PRIVILEGES.
Note that cPanel adds your account name in front: if you create the database wp, its full name will be something like tucuenta_wp. That full name is the one you need.
3. Export and import the database
Almost all local environments come with phpMyAdmin, the same tool you have in cPanel. In the phpMyAdmin on your computer, select the WordPress database, open Export and download the file with the default options. You'll get a .sql or .sql.gz file.
Then, in cPanel > phpMyAdmin, select the database you created in the left-hand column, open the Import tab, choose the file and click Import (at the bottom of the page) with the default options:

When it finishes, you should see a message saying the import was successful and the list of WordPress tables (wp_posts, wp_options…).
4. Edit wp-config.php
Now WordPress needs to connect to the new database. Open the wp-config.php file in public_html: you can edit it on your computer and upload it again over FTP, or edit it directly from cPanel's File Manager (right-click > Edit):

Change these values to those of the database you created:

DB_NAME: the full database name (with your account prefix).DB_USER: the full user name.DB_PASSWORD: its password.DB_HOST: leave it aslocalhost.
Don't change $table_prefix: it must stay the same as the one you used locally.
Just below the line define('WP_DEBUG', false); add these two lines with your final domain, so WordPress stops using the local address:
define('WP_HOME','https://nuevodominio.com'); define('WP_SITEURL','https://nuevodominio.com');

Save the file. The website should now load on your domain.
5. Change the links that still point to local
The lines above change the main address, but the content (images, internal links, settings of page builders such as Elementor) still stores the local URL, for example http://localhost/miweb. You need to replace it in the database.
Don't do it with find and replace in the .sql file: WordPress stores a lot of serialised data and a direct text change breaks it. Use one of these options:
- With a plugin: install Better Search Replace, go to Tools > Better Search Replace, enter the local URL in Search for and the final one in Replace with, select all the tables and run it first with the dry run box ticked. If the result is what you expected, untick it and run it for real.
- Over SSH with WP-CLI, from the WordPress folder:
wp search-replace 'http://localhost/miweb' 'https://nuevodominio.com' --all-tables --dry-run wp search-replace 'http://localhost/miweb' 'https://nuevodominio.com' --all-tables
The first command only shows how many changes it would make; the second applies them.
When you've finished, go to Settings > Permalinks and click Save Changes to regenerate the .htaccess rules.
Before you consider the website live
- In Settings > Reading, untick Discourage search engines from indexing this site if you turned it on during development.
- Browse several pages and check that the images load from the new domain.
- Test the forms and email sending.
- If the domain still points to another server, you can view the website on the hosting before changing the DNS.
You may also find useful
- Change the WordPress domain or URL Choose between the dashboard, wp-config.php and phpMyAdmin to change the WordPress URL, and replace...
- Change the domain or folder of a WordPress website Tell changing the public address of WordPress apart from moving its folder, and review paths, links...
- How to migrate WordPress to another hosting without losing data Move files and database, adapt WordPress and check DNS, orders and scheduled tasks before treating t...
- Increase the upload limit in All-in-One WP Migration Raise All-in-One WP Migration's maximum import size from the cPanel PHP selector or with a few lines...
Something wrong or out of date? Tell us and we will review it.