I have a web app built on Codeigniter, everything is working nice. When a user registers, he will get a dynamic username: username.domain.com.
I've wildcards working and everything is fine, except,. when they custom their domain name, like userdomain.com. This is done with a CNAME poiting to username.domain.com.
I'm using php to extract the username from the sudomain:
define('DOMAIN', 'domain.com');
$subdomain = str_replace('.' . DOMAIN, '', $_SERVER['HTTP_HOST']);
if (!empty($subdomain) && $subdomain != 'www' && $subdomain != DOMAIN)
{
define('SUBDOMAIN',$subdomain);
}
else
{
define('SUBDOMAIN',NULL);
}
With custom domains i cant get the username.
Any thought on this ?
Thanks