0

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

AFRC
  • 902
  • 3
  • 9
  • 27

1 Answers1

1

Your best bet is probably to map custom domains to usernames in your database.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368