We are hosting many web applications for our customers. As is obvious they want to use their own domains to refer to those applications, usually they want that any user tha
You have to put a period at the end of the external domain so it doesn't think you mean customer1.mycompanydomain.com.localdomain;
So just change:
customer1.com IN CNAME customer1.mycompanydomain.com
To
customer1.com IN CNAME customer1.mycompanydomain.com.
Thanks to both sipwiz and MrEvil. We developed a PHP script that will parse the URL that the user enters and paste www
to the top of it. (e.g. if the customer enters kiragiannis.com, then it will redirect to www.kiragiannis.com). So our customer point their root (e.g. customer1.com
to A
record where our web redirector is) and then www
CNAME
to the real A
record managed by us.
Below the code in case you are interested for future us.
<?php
$url = strtolower($_SERVER["HTTP_HOST"]);
if(strpos($url, "//") !== false) { // remove http://
$url = substr($url, strpos($url, "//") + 2);
}
$urlPagePath = "";
if(strpos($url, "/") !== false) { // store post-domain page path to append later
$urlPagePath = substr($url, strpos($url, "/"));
$url = substr($url, 0, strpos($url,"/"));
}
$urlLast = substr($url, strrpos($url, "."));
$url = substr($url, 0, strrpos($url, "."));
if(strpos($url, ".") !== false) { // get rid of subdomain(s)
$url = substr($url, strrpos($url, ".") + 1);
}
$url = "http://www." . $url . $urlLast . $urlPagePath;
header( "Location:{$url}");
?>