Hi, again -
I don't know what your exact scenario is, so I can't give you a simple "1, 2, 3" cookbook solution. I *do* believe I understand your *general* problem, and I think using different "/etc/hosts" files *might* be a good solution.
EXAMPLE:
Let's say you have a set of three production servers: PRODA, PRODB and PRODC. Between them, you've got one (or more) HTTP web servers, one (or more) databases, maybe a Java application server or two, and a whole bunch of PHP (server side) and/or js (client side) code.
Now let's say you've "cloned" this environment, for use by your development team. You've now got three *different* servers (DEVA, DEVB and DEVC) with the *same* mix of HTTP web servers, databases, web services and code. All of the code is using *all the same host names* (because it's the same code, and none of your code is using IP addresses. Right?).
Q: What do you do? How can you run tests in either/both environments without conflicts?
A: Have one set of hosts files for the PROD servers, and a different set of hosts files for the DEV servers. Deploy the PROD hosts files to the prod servers, the DEV hosts files to the DEV servers ... and use one or the other hosts file on your clients.
If a client has the DEV hosts files, it will point to the DEV environment. If the client has the PROD hosts files, then that client will point to the PROD environment.
In other words, I'm suggesting DON'T modify your code for the different environments, DON'T play with different vhost configurations ... but simply COPY the environments ("clone" them) ... then just use a different "/etc/hosts" file to execute one environment vs. the other.
It's really simpler than it sounds
And, depending on your exact scenario ... who knows? It just might work!
'Hope that helps .. and Good luck!