I needed a way in my multisite setup to have multiple environments that shared the same database, but used different domains.
… each of those would point to the same database. This is easy to achieve in a standard WordPress install using
define( 'WP_HOME', 'http://server1.example.com' ); and
define( 'WP_SITEURL', 'http://server1.example.com' );.
When you add multisite to the mix it breaks.
The problem is that the
wp_blogs table defines the domains too, so I needed a way to define them in the config file.
UPDATE: A more complete solution: https://github.com/developdaly/WordPress-Skeleton
Taking @chrisguitarguy‘s advice, I used sunrise.php to intercept the host and spoof it so that WordPress uses domain I customize to load the site content.