# How to manage image URLs through development to staging to production

**URL:** https://discourse.roots.io/t/how-to-manage-image-urls-through-development-to-staging-to-production/9423
**Category:** bedrock
**Tags:** deploys
**Created:** 2017-04-19T20:00:54Z
**Posts:** 3

## Post 1 by @viethj — 2017-04-19T20:00:54Z

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](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.

---

## Post 2 by @strarsis — 2017-04-19T20:47:57Z

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:

> [@Leveraging WP-CLI Aliases in Your WordPress Development Workflow](https://discourse.roots.io/t/leveraging-wp-cli-aliases-in-your-wordpress-development-workflow/8414/20):
>
> I am working on a repo [here](https://github.com/jasperf/trellis-sync). Raquelle as author (@cedarstay ) as well as @ben have been mentioned for the script they made and I added there. Thanks so much for sharing this and teaching me more about aliases and shell scripts! README is not quite done yet and tweaks me be needed. Feel free to submit pull requests or clone it.

Codex page (mentions database search+replace):  
[https://codex.wordpress.org/Changing\_The\_Site\_URL](https://codex.wordpress.org/Changing_The_Site_URL)

WP CLI (used by the tool mentioned above):  
[http://wp-cli.org/commands/search-replace/](http://wp-cli.org/commands/search-replace/)

---

## Post 3 by @viethj — 2017-04-19T22:10:20Z

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

-JV
