How do I move WordPress to another location (URL)?
If you use the powerful WordPress CMS software on your site, it’s possible to move it from one location to another, but you have to do it a certain way. This page explains several different possibilities.
Before making any changes, you should make an extra backup of your website.
On this page:
- Moving WordPress to a different location on the same site
- Expert procedure: Using the shell
- Moving WordPress to a different domain name where both domain names are hosted with our company
- Moving WordPress to a different server
- Changing the preferred domain name WordPress uses with aliases
Moving WordPress to a different location on the same site
If you’re moving WordPress to a different location on the same site, you’ll need to move the WordPress files and update the “URLs” in the WordPress database.
Tip: Let us do this for you, for free.
The instructions below explain how technically advanced customers can do this. However, the variety of themes and plugins means that in some cases, this won’t be enough, and additional changes will be necessary to get the site working.
If you’re a hosting customer of ours, we’ll be glad to do this for you at no charge: just contact us. We have the expertise to solve any additional problems with themes and plugins as a result of moving the site.
If you want to try this yourself anyway, the rest of this section explains how. You should make an extra backup first so you can restore the site if anything goes wrong.
For the sake of this example, let’s assume that you’ve installed WordPress in a folder such as “http://www.example.com/wordpress”, and you want to move it to the top level of the same site (“http://www.example.com”).
Although WordPress has instructions on their web site explaining how to do this, we recommend that you follow our instructions instead:
- Before you move the files, login to the WordPress administration dashboard at the old location (e.g., “http://www.example.com/wordpress/wp-admin/”).
- Click Settings.
- Change the WordPress Address (URL) to the new URL that you want to use (e.g., http://www.example.com).
- Change the Site Address (URL) to the same value.
- Click Save Changes.
- You’ll probably see a “404 Not Found” error page because WordPress no longer knows it’s at the old location. This is normal and can be ignored.
- If you’re moving the WordPress files to a location that already contains an index file such as “index.html”, “index.htm”, or “index.php”, you’ll need to move or rename the old file so the web server sees the WordPress files. We recommend moving all the existing site files into a folder called something like files-before-wordpress-move, which will also prevent them from being visited via outdated search engine links.
- Move the WordPress files to the new location using a shell connection, FTP connection, or some similar method. To make it go quickly, be sure to move the files instead of copying them.
- Login to the WordPress dashboard at the new location (e.g., “http://www.example.com/wp-admin/”).
- Click Settings, Permalinks, then click Save Changes without actually making any changes. (This step is necessary to update the .htaccess file with the correct “RewriteBase” rule.)
- Clear your browser cache and test your site.
These steps will make most WordPress sites fully work.
After moving your site, you may find that some existing menus or posts contain hard-coded link URLs that mention the old location. If you want to update them, we recommend doing this:
- Be sure you've made an extra backup of your website.
- On the new site, click Plugins / Add New.
- Search for: Velvet Blues Update URLs
- Install and activate the plugin
- Click on Tools / Update URLs and follow the directions.
Expert procedure: Using the shell
Again, we recommend letting us do this for you. But if you’re a technically advanced user comfortable using the command-line shell who wants to try it, this method is more efficient:
- Move any existing index file such as “index.html”, “index.htm”, or “index.php” out of the way as described above. Do the same with any existing “.htaccess” file.
- Move the WordPress files to the new location using the mv command. Be sure you move the “.htaccess” file too.
- Run a command like this to modify the URLs (this assumes you moved “/wordpress” to the top level of the site):
wp search-replace example.com/wordpress example.com --skip-plugins --skip-themes --report-changed-only --all-tables-with-prefix
- Run this command to update the “.htaccess” file:
wp rewrite flush --hard
- Run this command to delete any cache files:
rm -rf wp-content/cache/*
If you use the WP Super Cache plugin, you should also edit the site’s “wp-config.php” file to update the path in define('WPCACHEHOME', ....
That’s all it takes. You don’t need to use “Velvet Blues Update URLs” as described above because the “wp search-replace” command has already fixed any old URLs. Clear your browser’s cache to see the new site.
By the way, if you want to see exactly what wp search-replace will change before actually running it, try wp search-replace --dry-run --log example.com/wordpress example.com.
Moving WordPress to a different domain name where both domain names are hosted with our company
If you want to permanently move WordPress from one domain name to another, and Tiger Technologies hosts both domain names, you have three choices:
- If you’re sure going to keep both domain names registered and active with us forever, you can add the new domain name as an alias and follow the instructions below to change the preferred domain name WordPress uses.
- You can copy it between sites yourself using a WordPress plugin.
- You can ask us to do it for you, at no charge.
If you'd like us to move it for you, just contact us. Moving it may take up to one business day.
Moving WordPress to a different server
If you want to move WordPress to a completely different server (such as when you’re transferring a WordPress site to our company), you’ll need to actually export the WordPress data from one copy of WordPress to another.
We have a page that describes a few different ways to do this, with recommendations on when you should use each approach.
Changing the preferred domain name WordPress uses with aliases
If your WordPress site has a domain name alias pointing to it, and you want WordPress to prefer the alias domain name in links that it generates, you can update the domain name in the WordPress dashboard:
- Click Settings.
- Change the WordPress Address (URL) to the new URL that you want to use.
- Change the Site Address (URL) to the same value.
- Click Save Changes.
Copyright © 2000-2024 Tiger Technologies LLC