Moving a WordPress Site to a New Folder
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!
thank you for a great post. it seem very simple, I just wonder what will be the steps if one wish to test the new site before changing the DNS..
Great post! Thank you
This works great for all of the images.
Thanks!
But how do you get the old site to redirect to the new site?
[url=http://site.com/old-folder/same-existing-post/]site.com/old-folder/same-ex…[/url]
to redirect automatically to
[url=http://site.com/new-folder/same-existing-post/]site.com/new-folder/same-ex…[/url]
I am getting an error 404 endless loop.
So what gives with the endless loop?
All worked fine but my wp-admin is broken. It displays all wrong. Any advice please?
Please can you guide me. I believe you have experience with linode.
I had issue with htaccess on my newly moved wordpress from shared hosting to linode.
Everything was working fine before but now my site is off as I rebuilt linode.
I will like you to guide me on how I can install wordpress again with one click installation without being asked to create another linode that will make me to pay.
Please help me. Thanks
Thanks a lot for the author. It works and solves my big problem. Love to tell and share this kindly attempt of yours.
My website is broken few days ago because I transfer without knowing about this, after finding this tutorial on how to properly transfer a wordpress websites into another folder or domain within your hosting, now my website is working properly, all the images is perfectly correct and no broken links so far. I am planning on doing this and following the steps here for my other websites. Thanks again.