I developed our wordpress site on a subdomain, so I did not disrupt our homepage while I got everything up and running with Wordpress (It was originally running under Orchard, and I needed tochange it).

After the WP site was ready I changed the Wordpress Address general setting to the correct URL, and copied all the files over.

Unfortunately, it seems like this is not all that really needs to be done. Today (quite randomly, since it worked before oddly), images for a part of my site weren't showing up. Long story short it was because all of my WordPress media are pointing to the URL for them on the subdomain, NOT the core domain the site was currently running on.

After doing more research in the database, I can see other references to the subdomain still in the database, such as the posts.guid field in the database for all posts on the site.

What do I have to do to correctly move everything over to my core domain, so when I nuke the subdomain it doesn't affect the main site? I would prefer not having to completely recreate content (like re-upload images) if possible.


2 Answers 2


These two pages on the Wordpress codex give a good overview changing URLs:



However to cut a long story short, what I always do is the following:

  1. Back everything up
  2. Copy this handy little file to the root of your site: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
  3. Run it
  4. It should pick up all of your settings, so all you need to do is enter the old URL as the one to search for and the new as the one to replace it with.
  5. Once that's done you're ready to point the new URL at the site
  6. If you need to, obviously export the entire database to an SQL dump file and copy that and all the web files to the new location

I've never had any problems with this procedure.

A brief word on the searchandreplacedb2.php you downloaded in step 2. Lots of advice is to simply use a text editor to search and replace the old URL with the new URL in the SQL dump file. This will almost always work OK. However it can lead to problems. Wordpress makes heavy use of serialised arrays. If you have a plugin that for some reason stores the site's URL in a serialised array you risk breaking the plugin by doing a simple search and replace in a text editor. See the URL I linked to for further information on this.

  • Excellent, thank you very much. I'll mark this as the answer once I get a chance to try it out tonight.
    – KallDrexx
    Commented Dec 2, 2011 at 13:23

I prefer using a backup/restore plugin like Akeeba BackupWP with Kickstart.php to restore.

Not only does it backup the site and the database, but when restoring the site using the kickstart.php utility, it creates the database and changes all the db entries for the URLs.

All you need to do after restore is login and re-save permalinks and menus.

Entire process takes 15 minutes tops-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.