How do I create subdomain like http://user.mywebsite.com ? Do i have to access htaccess somehow? Is it actually simply possible to create it via pure php code or I need to u
We setup wildcard DNS like they explained above. So the a record is *.yourname.com
Then all of the subdomains are actually going to the same place, but PHP treats each subdomain as a different account.
We use the following code:
$url=$_SERVER["REQUEST_URI"];
$account=str_replace(".yourdomain.com","",$url);
This code just sets the $account
variable the same as the subdomain. You could then retrieve their files and other information based on their account.
This probably isn't as efficient as the ways they list above, but if you don't have access to BIND and/or limited .htaccess this method should work (as long as your host will setup the wildcard for you).
We actually use this method to connect to the customers database for a multi-company e-commerce application, but it may work for you as well.