Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have just moved hosts, and with the move I've also changed the setup that I have for media uploads.

I used to host my media on a subdomain called, but now that I have switched over, I want to go back to the traditional style. I have already backed up and relocated the content so it should be ready to go.

For example, yesterday, an image used to located here:

but now it is located here:

Could someone please help me with the necessary SQL statement to correct all of the old url references to the new format?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use a plugin like Deploy Helper. Essentially, it allows you to swap out all instances of one URL with another, and will also handle serialized data.

Just enter the old URL as and the new one as

Make sure you also reset your custom upload paths. If you'd defined constants like WP_CONTENT_URL or UPLOADS in your wp-config.php, remove them. Similarly, delete any possible settings in the database by loading wp-admin/options.php in your browser & emptying the values for upload_path & upload_url_path.

share|improve this answer
Thanks, that plugin worked great! – Mark Spivey Jun 26 '13 at 12:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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