7 - Dynamically changing links based on environment I am working with a Drupal site that is a central hub for several other pieces of software. The Drupal site and the other Software all have their own dev, testing and production environments. Each of these environments have their own url.

What I am looking to do is to change these urls based on the current envrionment by setting a variable/token of some kind. For example:


If the site is in dev, it links to all other dev versions of the software. For example dev-drupal.website.com links to dev-software1.website.com and dev-software2.website.com
If the codebase moves to testing, there is a file (for example the template.php) file that either doesn't need to be changed, or needs to be changed once to change all of the links.


There are over a dozens of these externally linking software pieces, and they are often linked in the content, but there are also menu items, blocks and a few views. Currently we have to do a find and replace to manually change these links one at a time. I'm trying to figure out if there is a better way, perhaps through a template variable or a token. Any ideas? This solution would ideally not be stored in the db, but I'm flexible.

I'm looking for suggestions on the best approach.
I don't think I would try to do this in Drupal. I would setup a small proxy server using Apache/mod_rewrite. You can rewrite your url's based on the source url. There is some good starter information at on the Apache doc site. There is also full on mod_proxy, but I think mod_rewrite would be sufficient for your use case.