How to Move a WordPress Install from a Directory to a Sub-Domain on the Same Web Host
Posted on October 14, 2013 in Command Line, Linux, WordPress by Matt Jennings
Some of the info in this post was taken from a post by David Coveney, James Whitehead and Robert O’Rourke or Interconnect IT! Thanks fellas!
- Log into your web host’s online control panel and create a sub-domain.
- Using a FTP Client, find the paths of where your WordPress install lives and where you want to place it. Copy those paths and paste them into a text editor.
- Navigate to the root of your server using a shell. Then type the example code below with the first path showing where your WordPress install lives and the second path showing where you want the WordPress install copied to:Note: Make sure there is a
.and NOT a
*after the first path of where the WordPress install currently lives. If you do not do this then you won’t copy hidden files, like
rsync -avpzt /home/janelynch/example.com/wordpress-old-location/. /home/janelynch/newfileslocation.example.com
- The steps from here on down are from the blog post mentioned above.
- Download the Database Search and Replace Script in PHP script (
searchreplacedb21.zip). This was originally found here.
searchreplacedb21.zipso that you see a file called
- Rename the file an unusual word, preferably in a foreign language. You could name it something like
maktub.phpwhich means “it is written in Arabic”.
maktub.phpto the root directory of your WordPress install. This is where the
- Go to the URL where
- On that page you under the “Load DB connection values from WordPress?” text make sure the “Pre-populate the DB values form with the ones used in wp-config? It is possible to edit them later.” checkbox is checked. Then click the
- On the new page you will see a “Database details” heading. Enter the appropriate information in all the fields. For the “Server Name” field you will need to add the database host name. You do not need to fill out the “Charset” field. Click the
Submit DB detailsbutton.
- You will now see a new page with a “Which tables do you want to scan?” heading. Click the first table in the listed, scroll to the bottom of the tables and then hold the
Shiftkey and click the last row table to select all of the tables.
- Leave the “Leave GUID column unchanged?” text box unchecked and click the
- If you see a pop up window that “Do you be sure that you selected the correct tables – especially on multi-site installs” click
- You will be on a new page with a “What to replace heading”. [To be continued]