Moving Your WordPress Directory

When developing the new version of an existing website, what a lot of people do is develop it at a subdirectory of the current site, at e.g. www.example.com/newsite. When your new site is ready for production, you'll probably need to move it up to the top level e.g. www.example.com - here's what you need to look out for when you're doing that.

First, make a backup of the old site - in FTP create a directory called something like "oldsite" and move all of the files and folders except /newsite in there.

WordPress location settings

Next, go to General Settings in the new site WordPress dashboard, which can be found at www.example.com/newsite/wp-admin/options-general.php. What you need to do is change the following settings:

WordPress address (URL)
Site address (URL)

Change the text box entries so that they both have "http://www.example.com/" instead of "http://www.example.com/newsite". Now click "Save Changes".

Don't be concerned that you now see an error message - this is correct behaviour and is expected.

Here's where we do the 3rd step! Using FTP move all of the files out of "/newsite" and into "/". Tip: you can do this quickly by going to /newsite in Filezilla, doing Select-All (Ctrl-A) and drag and drop the files onto the ".." symbol. In computer terms ".." means "up one level".

Once all of the files have moved, you can now log into WordPress at its new location: go to http://www.example.com/wp-login.php to login.

This post is based on a question Josh asked in the Community Forums - thanks!

Note that in this post I'm making some assumptions about where you want to have WordPress installed, if you're not sure then this setup should be fine. More info on the WordPress Codex.

About Alastair McDermott

Alastair McDermott is an online business and technology consultant specialising in web design & development, internet marketing and search engine optimisation. He has been building websites and software since 1996 and is a ten year veteran of using WordPress.

Alastair blogs and makes media of all kinds at WebsiteDoctor. Follow him on Twitter at @WebsiteDoctor.
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *