How do I modify Drupal so that ONLY relative URLs are used through the whole site?
You can alter all Drupal generated URLs to make them root relative using hook_file_url_alter

function mymodule_file_url_alter(&amp;$uri) {
  global $base_path;

  $scheme = file_uri_scheme($uri);

  if (!$scheme || $scheme == 'public') {
    if (!$scheme) {
      $path = $uri;
    }
    else {
      $wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);
      $path = $wrapper-&gt;getDirectoryPath() . '/' . file_uri_target($uri);
    }

    // Clean up Windows paths.
    $path = str_replace('\\', '/', $path);

    $uri = $base_path . ltrim($path, '/');
  }
}


For links in content you can apply the filter supplied by Pathologic