Moving a WordPress site to a new folder is something you may need to do regularly.
The most common reason is that you’re launching a new site. In this tutorial, we”ll show potential problems during the move and how to overcome them.
Note: we’re not showing you how to move to a new server, simply to a new folder.
Step 1: Move the Files
The image below shows my WordPress site. Currently the site is happily sitting inside a folder called /oldlocation/ and it’s working perfectly.
- Login to your site’s files via FTP.
- Move all of your WordPress files from the old folder to the new folder.
- Your site will now look like the image below. Almost everything will be broken.
- In fact, you won’t even be able to login. If you try to access /new-location/wp-admin/, you’ll be redirected to /old-location/wp-admin/ and that will produce a 404 error.
Step 2: Change Site URLs
In order to regain access to your site, you first login to your site’s database. In this example, we’re using PHPMyAdmin which was provided by our hosting company.
- Access your site’s database.
- Look for the wp_options table.
- Look for the siteurl row in the table. It will still contain your site’s old URL.
- Edit that siteurl row.
- Click Go to save the changes.
- Now you can login to your site at the new URL
- Go to Settings > General.
- Make sure that both WordPress Address and Site Address are set to your new URL.
- Click Save Changes.
Step 3: Fix the Permalinks
The .htaccess file that controls your site’s permalinks also contains your site’s URL. So, we need to fix your Permalinks.
- Go to Settings > Permalinks.
- Enter your URL choices.
- Click Save Chnages.
Step 4: Fix the Images
- When you visit your site now, everything should be working correctly, except for your images:
The reason for this is that WordPress actually hardcodes the URL of image into posts and pages.
You have two choices for fixing this:
- If you have a small site, you can change the image URLs manually.
- If you have a site of any real size, you’ll need to change the image URLs automatically. For this we recommend the Velvet Blues Update URLs plugin.
- Install and Activate the Velvet Blues Update URLs plugin.
- Go to Settings > Update URLs.
- Enter your old URL and new URL.
- Click Update URLs NOW.
- Your images will now be fixed.
- Your site move from the old folder to the new folder will be complete!