create subdomain programatically in PHP -
i on shared hosting , on add on domain.
i need create subdomain each user of website if username jeff should have url jeff.mydomain.com.
how can create programatically using php?
thanks prady
there's 2 parts this. firstly you'll need setup wildcard dns entry.
once you've got setup should have requests pointed single domain. there can use php figure out domain you're on:
$domain = $_server['http_host']; $base = 'mydomain.com'; $user = substr($domain, 0, -(strlen($base)+1));// user part of domain if(!empty($user)) { $user = sanatiseuser($user); require_once $user.'.php'; }
Comments
Post a Comment