| WordPress

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.

media_1351024363365.png
  • Login to your site's files via FTP.
  • Move all of your WordPress files from the old folder to the new folder.
media_1351026817420.png
  • 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.
media_1351024554937.png

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.
media_1351025224196.png
  • Edit that siteurl row.
  • Click Go to save the changes.
media_1351025275952.png
  • 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.
media_1351025370429.png

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.
media_1351026583089.png

Step 4: Fix the Images

  • When you visit your site now, everything should be working correctly, except for your images:
media_1351025559976.png

The reason for this is that WordPress actually hardcodes the URL of image into posts and pages.

media_1351025579907.png

You have two choices for fixing this:

  1. If you have a small site, you can change the image URLs manually.
  2. 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.
media_1351026015779.png
  • 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.
media_1351026078593.png
  • Your images will now be fixed.
  • Your site move from the old folder to the new folder will be complete!
media_1351026151805.png

About the author

Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.