How to create sub site?


How can I create sub site like using PHP?

Let’s say I have and not I want to get created for user “a”. Any way to create this dynamically using PHP?


This is more of a web hosting issue. You need to check with your web hosting control panel. What you want to look for is the facility to create subdomains (the “a” in [noparse][/noparse] is a subdomain). This is pretty standard on a lot of hosting accounts, such as those that use CPanel.

What you actually need is wildcard subdomains. Like, * would point to the same place as and Apache or IIS would treat it the same. In PHP you would then use $_SERVER[‘HTTP_HOST’] to find if the subdomain is a valid username.

However, I must recommend against such practice. While it is nifty, it is a lot of work to get right, and can have security implications.

Thanks a lot for quick response! Both answers address the issue.