hijacking home_url for root relative paths

You need to set the WP_HOME and WP_SITEURL in wp-config.php in a smarter way. Like this:

<?php
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
// add the next line if you have a subdirectory install
define('WP_SITEURL', WP_HOME . '/path/to/wordpress');

This will solve your your issues with site URLs as they will be set dynamically on based on whatever the hostname is. This is the correct way to do this — it’s something I do on virtually ever WP install and it’s even in the codex. Believe me, you don’t really want relative urls.