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

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -