WebGee DocsDocs
WordPress

Move a local WordPress site to your hosting

Deploy a WordPress site built on your own machine to a cPanel account — files, database, wp-config and the URL rewrite that catches people out.

Move a WordPress site you built locally onto your WebGee hosting. Applies to shared, reseller and Premium hosting.

Four things have to move: the files, the database, the database credentials in wp-config.php, and the site URL stored inside the database. Missing the last one is the usual reason a migrated site loads a broken page.

Before you begin

From your local site, take:

  • A copy of the whole WordPress directory — including wp-content, which holds your themes, plugins and uploads.
  • A database export as .sql. Most local tools export this from phpMyAdmin, Adminer or their own interface.

Also note the local URL the site currently uses, such as http://localhost:8888 or http://mysite.test. You need it for step 5.

1. Add the domain

In cPanel, open Domains and add the domain or subdomain you want the site to live on. Note the document root it creates — usually public_html for the main domain.

2. Create the database

  1. In cPanel, open MySQL Databases.
  2. Create a database.
  3. Create a user, with a generated password.
  4. Under Add User To Database, add the user to the database and grant All Privileges.

Keep the database name, username and password — you need all three in step 4. Both names are prefixed with your cPanel username.

3. Upload the files

Upload the contents of your WordPress directory into the document root, using File Manager or FTP — see Upload files with FileZilla.

Upload the contents of the WordPress folder, not the folder itself. If you end up with public_html/wordpress/wp-config.php, your site will be at example.com/wordpress rather than example.com.

A zip uploaded and extracted through File Manager is far faster than transferring thousands of small files over FTP.

4. Import the database

  1. In cPanel, open phpMyAdmin.
  2. Select your new database in the left sidebar.
  3. Select Import, choose your .sql file, and select Go.

If the file is too large to upload, see Import a large database.

5. Update wp-config.php

Edit wp-config.php in the document root and set your new credentials:

define( 'DB_NAME', 'cpaneluser_wordpress' );
define( 'DB_USER', 'cpaneluser_wpuser' );
define( 'DB_PASSWORD', 'your-database-password' );
define( 'DB_HOST', 'localhost' );

DB_HOST stays localhost — the database runs on the same server as the site.

6. Replace the local URL in the database

This is the step people miss. WordPress stores its own address in the database, so the site will keep referring to localhost and load without styling, or redirect you back to your own machine.

In phpMyAdmin, select your database, open the SQL tab and run:

UPDATE wp_options SET option_value = 'https://example.com'
  WHERE option_name IN ('siteurl', 'home');

Change wp_ if your site uses a different table prefix — check the $table_prefix line in wp-config.php.

That fixes the site address. Local URLs are usually also embedded in post content, widgets and theme settings. The Better Search Replace plugin handles those safely, including inside serialised data, which a plain SQL find-and-replace will corrupt.

Check it worked

Visit https://example.com. The site should load with its styling intact. Sign in at /wp-admin and check that images in existing posts display.

If something is wrong

  • "Error establishing a database connection" — the credentials in wp-config.php are wrong, or the user was not added to the database in step 2.
  • The page loads with no styling — step 6 was skipped, or wp_ was the wrong prefix.
  • You are redirected to localhost — same cause.
  • Images are missing from posts — their URLs still point at the local site. Run Better Search Replace.

On this page