Whether you're moving WordPress to a new server, changing its URL, or relocating it within your existing server, you don't need to reinstall. WordPress is designed to handle each of these scenarios with the right combination of file moves, database edits, and configuration changes.
About moving WordPress
This guide summarizes the three most common move scenarios on Exact Hosting hosting: moving to a new server, moving to a new directory on the same server, and moving a Multisite network. For canonical references, see the official WordPress documentation on moving WordPress and Changing the site URL.
Warning: Always make a full backup of your WordPress files and database before starting a move. See WordPress manual backup (Softaculous).
Before you begin
- A complete backup of your WordPress files and database. Move work is irreversible without a backup.
- Access to cPanel, phpMyAdmin, and File Manager (or FTP). You need these to download/upload files and export/import the database.
- Your new server's database details. If you're moving servers, have the new MySQL database name, user, and password ready.
Moving WordPress to a new server
If you're moving WordPress from one server to another, start by backing up your WordPress directory, uploads, plugins, themes, and the database. See WordPress Backups and Backing Up Your Database for guidance.
Keeping the same domain and URLs
If the domain name and site URLs stay the same, the move is straightforward:
- If the database name and user are unchanged, copy your files and database to the new server as-is.
- If the database name or user changes, edit wp-config.php with the correct values.
- To test before switching, temporarily change siteurl and home in the wp_options table (via phpMyAdmin or similar).
- If you use permalinks, disable .htaccess and reconfigure permalinks once the new server is live.
Changing the domain or URLs
If you're also changing the domain or URL structure (for example, example.com/site to example.com, or example.com to example.net), follow these steps in order:
- Download your existing site files.
- Export your database from MySQL.
- Save the files and database in a safe location as your backup.
- Log in to the existing site and go to Settings > General. Update both URL fields to the new domain. Save the settings — you may see a 404 page after saving.
- Download the site files again.
- Export the database again.
- Edit wp-config.php with the new server's MySQL database name, user, and password.
- Upload the files to the new server.
- Import the database on the new server.
Warning: Do not run a blanket SQL search and replace on serialized data. Some themes and widgets store values with the URL length encoded — changing the URL with a plain search/replace breaks them. Use one of the safe options below instead.
To safely update URLs across the database, use one of these options:
- Velvet Blues Update URLs plugin — if you can access the WP Admin dashboard.
- Better Search Replace plugin — if you can access the WP Admin dashboard.
- WP-CLI search-replace — if WP-CLI is available on the server.
- Search and Replace for WordPress Databases Script (interconnectit) — for users comfortable with database administration. Third-party script.
Moving WordPress to a different directory on the same server
Moving files between directories on the same server requires extra care. If you want WordPress to live in its own folder while running from the root domain, see Giving WordPress Its Own Directory.
Note: Always set the new URI locations before moving the files.
- Prepare the destination:\n
- If moving WordPress core files to a new directory, create that directory.
- If moving WordPress to your root directory, back up and remove existing files (index.php, .htaccess, and any others that might be overwritten).
- Log in to your WordPress site.
- Go to Settings > General.
- In WordPress Address (URL), enter the new location of your core files.
- In Site Address (URL), enter the new public URL (usually the same as the WordPress address).
- Click Save Changes. Do not try to open your site yet.
- Move the WordPress core files and all sub-directories to the new location.
- Open your site at yourdomain.com/wp-admin (or wp-login.php).
- If you use permalinks, go to Settings > Permalinks and update them to refresh the .htaccess file.
- Update existing image and media links — they still reference the old folder. Use Velvet Blues Update URLs, Better Search Replace, WP-CLI search-replace, or the interconnectit script.
- Check file permissions. Reset any files with 0000 permissions back to 0644.
- If your theme uses menus, update menu links that include the old subdirectory under Appearance > Menus.
- Restart the server if it returns errors. (This affects some local environments like MAMP.)
If you forgot to change the URIs before moving the files
If you moved the files before updating the URIs, you have two recovery options:
- Create a symlink. If the files were in /path/to/old/ and you moved them to /path/to/new/, create a symlink: ln -s /path/to/new /path/to/old. Then follow the steps above. Remove the symlink afterward.
- Edit the database directly. If the URIs are wrong and you can't reach the WordPress interface, edit the wp_options table directly. Update the option_value for the rows where option_name equals siteurl or home.
If you accidentally changed your WordPress site URL
If you can still reach the login page (through a redirect or similar), you can use wp-login.php to reset the URIs. Find this line:
require( dirname(__FILE__) . '/wp-load.php' );
Add these lines below it, then load the login page once:
update_option('siteurl', 'http://your.domain.name/the/path' );\nupdate_option('home', 'http://your.domain.name/the/path' );Remove the temporary lines once the database is updated. For more, see Changing the Site URL.
Managing your old site after a move
Shutting down the old site
- Download the main WordPress files from the old site. Edit wp-config.php to match the new server.
- On the old site, go to Settings > General and change both URLs to the new site's URL.
- Log in to phpMyAdmin on the old server, export the database, and save a copy.
- Upload the database and updated WordPress files to the new server.
Keeping the old site running
Warning: Back up the old site's WordPress database before starting. You'll restore it at the end.
Part A — Activating the new site:
- Download the entire WordPress installation to your local machine. Label the folder as the OLD site.
- Download the database.
- On the old site, change both URLs in Settings > General to the new site URL.
- Download the entire WordPress installation again. Label this folder as the NEW site.
- Download the database again. Upload it to the new server. Using the same database name and user simplifies the process.
- If you used a different database name or user, edit wp-config.php in the NEW installation folder.
- Upload the NEW installation folder to the new server. The new site should now be live.
Part B — Restoring the old site:
- On the original server, delete the OLD site's database. (You have a backup from step 1 above.)
- Upload the OLD site's installation folder back to the original server, overwriting the current files.
- Upload the OLD site's database back to the original server.
Alternative: export/import posts and pages
To copy only posts, comments, pages, categories, and custom fields, use the built-in import/export tools:
- Install a new WordPress site.
- On the old site, go to Tools > Export, select All, and click Download Export File.
- On the new site, go to Tools > Import and choose WordPress.
- Select the export file. Click Upload file and Import.
- Assign authors to existing users or create new ones.
- Click Submit to complete the import.
Note: This method adds articles to the new site without erasing existing ones (such as the default "Hello World" post).
Moving WordPress Multisite
Multisite moves are more complex because the database contains multiple references to the server name and folder structure.
- If moving to a new server with the same domain, copy the files and database as you would a single-site install.
- If changing domains, move the files, edit .htaccess and wp-config.php (update DOMAIN_CURRENT_SITE and, if the folder changed, PATH_CURRENT_SITE), then manually edit the database with the Search and Replace for WordPress Databases script.
- If moving Multisite between folders, edit the wp_blogs entries to update the folder name. Manually review wp_site and wp_blogs to confirm all sites were updated.
- Manually review all wp_x_options tables and update home, siteurl, and fileupload_url.
- If switching between subdomains and subfolders, adjust the .htaccess file and the SUBDOMAIN_INSTALL value in wp-config.php.
Next steps
- Back up before you move. See WordPress manual backup (Softaculous).
- Test the move on a staging site first. See Creating a Managed WordPress staging site.
- Update plugins and themes after the move. See Updating WordPress plugins and Updating WordPress themes.
Questions? Contact Exact Hosting Support.
Related articles
- Migrating an Existing Website to Exact Hosting — general site move-in guide
How helpful was this article?
Thanks for your feedback!
Do you still need help? If so please submit a request here.