Changes after code review:

- fixed url handling when removing protocol or server part:
    - only removes protocol and hostname from the beginning of the URL
      (previously an URL like "http://foo/foo" would have been converted to "/")
    - handles protocol relative URLS
      (previously an URL like "//foo/foo" would have been converted to "///")

- fixed module name in error message

- removed dead code and commented-out debug logging