1

Our scenario is a large MultiSite network, our team builds stage sites for clients by creating a new subsite on the network, so the URL for dev work and then for the client to preview is something like

stagesite.ourcompany.com

Now once all content is good and the client OK's going live, the domain gets mapped and so now the live site url is something like

clientcompany.com

However, we now end up with a lot of wrong URL's in crawl reports, where links, images etc are pointing to the development URL.

Two questions,

  1. How do you handle the staging site development for urls?
  2. Is there a quality plugin or something for bulk updating all relevant URL's?

Note that I have explored the idea of altering host file and just building it out on the actual domain name, however that is not doable for half my team or any of the clients.

Thank you.

  • Try searching the site, there are more then enough threads concerning this topic. – Nicolai Jan 15 '15 at 0:50
1

I'd recommend the following: (no affiliation)

https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

For some reason I've had odd experiences with the search and replace db plugin recently.

Also, I'd avoid using the defines in your wp-config.php file as some plugins do not use it and show strange behavior. Better to update the wp-options table for those two options if at all possible (at least, that has been my experience).

I do a lot of what you are doing ... and have never had an issue using the above tool. Just make sure to pull it back off the site once you are done.

  • Thanks, I have used this tool before, but not sure if best approach because we run hundred of sites on our network and would have to install/remove very often ;) – thatryan Jan 15 '15 at 6:14
0

There are few ways to change the URL as you can see here: http://codex.wordpress.org/Changing_The_Site_URL

You can either use constants like so in your wp-config.php:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Or you can change the database. A good plugin you can use is the Search and Replace: https://wordpress.org/plugins/search-and-replace/

Another safe method, if you have access via terminal SSH, you can use the WordPress Command Line: http://wp-cli.org/commands/search-replace/

  • I am playing with wp-cli right now actually, very new to it though. Have you used it much? Know a good place to ask questions about it? – thatryan Jan 15 '15 at 6:15
  • Yeah, I have. It works very well for multisite also. The official website is very well documented, but any issue, you can either ask here or open an Issue on github: github.com/wp-cli/wp-cli/issues – Leo Caseiro Jan 16 '15 at 4:36
0

Velvet Blues is what you're after.

Also, I'm sure you're probably doing this already, but I probably should say it anyway: it's best practice to discourage search robots from indexing the site while it's on its developmental URL.

If you prefer to use a MySQL query instead of Velvet Blues, this should work too:

UPDATE wp_posts SET post_content=(REPLACE (post_content, '<old url>','<new url>'));

You'll need to substitute table name and the URLs, but that should do.

Hope that was helpful!

  • Thank you, I tried that plugin first actually but it did not seem to do anything. Example, image on homepage has source of dev url, I ran plugin, purged cache, image still has dev url... :/ – thatryan Jan 15 '15 at 6:16
  • Did you try the MySQL solution? – Tejas Jan 15 '15 at 9:27
0

I highly recommend BackupBuddy (a paid solution, from iThemes.com).

Recommended non-paid alternative include:

All of the above properly and automatically handle search-and-replace of URLs inside the database, for serialized data as well.

And, if you need to manage the above for hundreds of sites, WP-CLI should be able to help -- for BackupBuddy, and probably for the other tools as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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