Hello, Is there a possible way to set up subdomains for a domain automatically; in programming code for example? Like when a user registers on a site, he automatically gets a subdomain assigned. Regards, Fat Abbot
I think not .If you use cPanel you can use iPanel: http://www.ihostdev.com Or cPanel Subdomains Creator: http://www.zubrag.com/scripts/cpanel-subdomains-creator.php
I used that subdomain creator, it works, but how can you automatically make the subdomain point to a users profile for example ? Like user.site.com should display: site.com?profile.php?username=user
I do this, but on a Windows server with Apache 2.x.x. The big trick is this: in your httpd.conf file you need your first virtualhost to contain: VirtualDocumentRoot "dir_path_to_where_you_want_the_subdomains_to_be\%1" This requires the vhost_alias_module (mod_vhost_alias.so) to be loaded in your DSO support section of httpd.conf. Now all you have to do everytime you want to grant somebody a subdomain is just create the subdirectory with mkdir(). (and, of course, record his details in your DB for your own reference.) I did battle my butt off to get the thing to work the first time, but there is quite a lot of documentation at apache about mod vhost_alias. If I remember correctly, the biggest struggle was because I wasn't putting that vhost with the virtualdocumentroot first. I also forget now whether I needed followsymlinks for the directory section pertaining to the domain. "dir_path_to_where_you_want_the_subdomains_to_be\%1" really just tells apache to take the first part of the server string and stick it on the end of the root domain, eg subdomain1.mysite.com becomes mysite.com/subdomain1 Of course, you'd want to regulate the signup process to include a check on what subdomains have already been dished out, as well as whichever you've used for yourself. Works like a bomb, and I don't have to do anything at all (my favourite activity! ). If you have any problems, just give me a shout.