How to manage image URLs through development to staging to production


With Bedrock and Capistrano, what is the best way to manage image URLs from development to staging to production? For example, when developing locally, URLs for images added to the media library might begin with http://localhost:8000. When that application/database is deployed to staging or production, those image URLs are no longer appropriate. Does Bedrock manage this automatically somehow? If not, what is the best approach to deal with this? In the past, I have run manual database cleanup scripts. Alternatively, I know there are plugins that are supposed to automate this process and/or make it easier. Before I settle on one of those approaches, I want to make sure I’m not overlooking “the Bedrock way.” Please advise.


There is a nice tool for this which also replaces the URLs automatically - the way how it does is also recommended by WordPress Codex.
Tool discussion:

Codex page (mentions database search+replace):

WP CLI (used by the tool mentioned above):

Uploads/Media Best Practice
Allowing Updates on Production Site

Thanks! WP-CLI’s search-and-replace it is!