Guys, I'm planning to build a website that able to register users which their usernames will become their own subdomains. Would you please help me to rewrite the specific subdomains of http://firm.tk to the query string of firm.tk/sites.php?domain= For example, firm.tk/sites.php?domain=test and firm.tk/sites.php?domain=user and firm.tk/sites.php?domain=name are all exist, all of test.firm.tk and user.firm.tk and name.firm.tk will automatically rewrite those files that in query string. And tell me what's the requirements to do that, such as do a free web hosting have a capacity to do it? Or any sure tips related to this topic?
The first thing you will need is to find a web host that allows you to use wild card subdomains and point them to the same directory. I have rarely found a free web host that does this so your best bet would simply to rent out a VPS and setup Apache or whichever web server you wish to use yourself. From there you will need to write a bit of .htaccess. Sadly I am not the best at .htaccess and unable to help without trying it myself first. That said search on Stack Overflow as someone has likely posted examples before.
Thanks for responding! But, I still wonder if subdomains can rewrite to those kinds of main query strings even without the use of wild card DNS. And I want to try to write an .htaccess first before finding a free host that supports a wild card if it's posible.