Backups and migrations

Publish a locally developed WordPress site on your hosting

Reviewed on 4 min read wordpress migraciones

To publish a WordPress site developed on your computer, you need to move its files and its database, adapt the configuration and check it with the final domain. If the website is already running at another provider, follow the WordPress migration between hosting providers.

Prepare the destination

Add the domain to the hosting and check its document root in cPanel. It will not always be public_html: use the folder assigned to that domain. If it contains another website, keep a backup and plan the replacement before uploading files.

Check the PHP, extension and database versions. If your local tool uses SQLite or another special setup, prepare an export the destination supports; copying its internal database files is not enough.

Upload the files

Transfer the files via SFTP/FTPS or the cPanel File Manager. Include wp-content and any hidden files the installation needs.

If you upload an archive, check when extracting it that there is no extra folder between the domain root and the WordPress files. Remove the package when you finish and do not publish SQL dumps or development secrets.

Create and import the database

  1. Create a database and a user with the MySQL wizard. Give that user the necessary privileges on that database.
  2. Export the local database in a compatible format, such as SQL or compressed SQL.
  3. In phpMyAdmin, select the new database, open Import and load the file.
  4. Check that the import finishes without errors and the expected tables appear.

Do not import over another application to see whether the file works. If the upload limit is exceeded or an incompatibility appears, keep the error before repeating the import.

Adapt wp-config.php

Update the existing connection values, without creating duplicate definitions:

Value Destination detail
DB_NAME Full name of the database you created
DB_USER User linked to that database
DB_PASSWORD That user's password
DB_HOST MySQL server given by the hosting

Keep the table prefix that matches the import. Also check the debugging options and any local paths that do not exist on the hosting.

Replace the local addresses

Follow how to change the WordPress URL. The public address and the location of the files can have different paths; do not make them the same automatically.

If WP_HOME and WP_SITEURL are defined in the configuration, the fields in Settings > General will be locked. Update the stored options in a suitable way and remove the constants only when the saved values are correct.

To replace links and images that still point to the local environment, use a tool that supports serialised data and run a simulation first. Do not do a global text replace in the SQL file.

Test before treating it as published

Check HTTPS, inner pages, images, the admin area, forms and email sending. Review the integrations: local test keys must not be mixed up with production ones, and you must not test real payments by accident.

If the domain still points to another website, you can preview the destination before the DNS change. Afterwards, remove the local change and check public access.

Delete packages and SQL files from the public directory, set up backups and check in WordPress whether you left the option to discourage search engines turned on during development. Keep any test environment that holds the website's data protected.

You may also find useful

Something wrong or out of date? Tell us and we will review it.