Creating sub-domains with PHP - is .htaccess the best way?
Posted on 2010-09-18
I've got a need to create sub-domains automatically in code as part of a project that i'm working on. Having surfed around the web its seems one of those things that different people have got different views on.
Can anybody suggest the best option? My thought was to set up a section in the .htaccess file, so that anything.domainname.tld gets redirected to domainname.tld/anything. Would that work? Is it secure and is it the most efficent way of doing things?
Programmically we are using php and a bit of python, if anyone can suggest other ways? Are there any code frameworks for php that provide an easier or better way of working where sub-domins are concerned?