Change URL in Source with reverse proxy

apache-2.2redirectreverse-proxysearch-and-replace

sometimes we make copies of live sites on another server to test new features. A lot of CMS systems hardcode the URL in the database, so it is not possible to just use another URL.
On our local systems, we just use the hosts file to redirect the requests to another IP.
This is far to complicated for our customers, so we need a simpler way for them.
It is possible to use apache (we use apache as webserver) as reverse proxy, so it redirects dev.somedomain.com to anotherdomain.com.
The only problem left is, that there are absolute links to anotherdomain.com in the HTML source.
Is there a way to just let apache (or another software) replace all links to http(s)://anotherdomain.com to http(s)://dev.somedomain.com in all pages (+js +css)?

Performance is not an issue, since this will obviously never run at a system that is used by more than a few people.

Best Answer

Apache does have a module for this - it's called mod_filter.