add support for sub-domain sub-sites in multisite

This primarily adds support for sub-sites on multisite sub-domain installs allowing the stage to be switched to the same sub-domain on another environment.

A few other minor enhancements:

* directory independent logic is now also protocol independent
* menu item id is now prefixed with `stage_` to protect against possible conflicts with menu items with the same id as a stage handle