Today I was browsing ebay.com and I come to know that for every main category they created a sub domain, like there is a category watches and the URL for watches will be like watches.ebay.com etc.
Now I wanted to know what whey is to so that I can create a sub domain using PHP script.
basically the thing i want to copy ebay model and that's why i am looking for making these sub domains.
if any one has any good suggestion also suggest me on it and you know they [ebay] people has a huge database can mysql bear this thing or not?
I dont know too much about php, but im pretty sure you cant create sub-domains. Usually you make sub-domains through your host, and most of the time you can only create them on paid hosts.
You can create them via php, but it's much easier to use mod-rewrite to create 'fake' subdomains. I'm sure that's what ebay does, can't imagine them having hundreds of subdomains all of which contains the same things
I have had to create dynamic subdomains based on values in a mysql db for some projects at work and its not as hard as you would think.
What I have is wildcard DNS, apache virtual hosts, and php working together to pull it off.
Widlcard DNS will send all request to my server where I have normally have 3 virtual host for every site.
one is mydomain.tld
another is admin.mydomain.tld
the last is *.mydomain.tld
it needs to go in this order so that real subdomains don't get served by *.mydomain.tld
Once there, I use modrewrite (only on *.mydomain.tld) to set an ENVIRONMENT variable, which is available to php, for the subdomain.
I can then show dynamic content for the subdomain.
It can act as username, company name, project, or some other unique identifier, which is stored in MySQL.
__________________ eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."
__________________
No trees were harmed in the transmission of this message.
However, a rather large number of electrons were temporarily
inconvenienced.