EV1 only give you 7 free IPs and I didn't want to waste them
• Having to use a dedicated IP for each one
• Creating them manually for each domain
• Any other labourious method
And I found one! IIS's "Default Web Site" handles requests for all domains on an IP that are not handled by another VHost. And with a little bit of PHP magic... we have global subdomains without extra IPs.
Heres what you have to do (assuming you don't actually use the default website):
• Open the IIS MMC, find "Default Web Site" in the list of domains. Properties -> Documents, add index.php and move it up to the top of the list.
• Goto the document root for the default website (c:inetpubwwwroot by default), and create a file called index.php.
• Put the following code in the file you just created:
[php]
/* chris@onestopwebhosting.com */
$redirects = array(
"webmail" => array(
name => "webmail",
url => "http://webmail.onestopwebhosting.com"),
"mail" => array(
name => "mail",
url => "http://webmail.onestopwebhosting.com"),
"helm" => array(
name => "cp",
url => "http://cp.onestopwebhosting.com")
/* add more here, in the following format:
"friendly name" => array(
name => "subdomain",
url => "http://url.subdomain.points.to")
EG:
"phpmyadmin" => array(
name => "phpmyadmin",
url => "http://phpmyadmin.onestopwebhosting.com")
*/
);
$host = strtok($_SERVER['HTTP_HOST'], '.');
foreach ($redirects as $redirect) {
strchr($redirect['name'], '.');
}
foreach($redirects as $redirect) {
if (strcasecmp($redirect['name'], $host) == 0) {
$url = sprintf("Location: %s", $redirect['url']);
header($url);
}
}
?>
[/php]
• Change the URLs at the top of that code to point to your global webmail / Helm / etc install.
• Add any other global subdomains you want to the list in the code using the format described in it.
• Check the permissions on index.php are correct. The easiest way to do this is to reset them. Goto the properties of the folder its in, goto the Security tab, click advanced, check "Replace permission entries on all child objects with entries here that..." and then click apply.
• Restart IIS.
The subdomains you listed in the code should now work with all domains and redirect to the relevant pages
If customers create subdomains, they will override the settings here (which is a good thing in most setups).
Hope you find this useful