Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    May 2006
    Posts
    107
    Thanks
    1
    Thanked 0 Times in 0 Posts

    creating subdomains

    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?

  • #2
    Regular Coder kosstr12's Avatar
    Join Date
    Apr 2007
    Location
    Woodstock, Georgia
    Posts
    428
    Thanks
    7
    Thanked 5 Times in 5 Posts
    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.

    HTH,
    kosstr12

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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

  • #4
    Regular Coder
    Join Date
    Apr 2007
    Posts
    141
    Thanks
    3
    Thanked 1 Time in 1 Post
    how to create " fake " domain then? lol

  • #5
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    lol, Google ftw

    http://www.modrewrite.com/

  • #6
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    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."

  • #7
    New Coder
    Join Date
    Jan 2007
    Posts
    64
    Thanks
    0
    Thanked 1 Time in 1 Post
    From Google

    Dynamic subdomains... like on imeem and such...

    PHP Code:
    $site_url strtolower($_SERVER['HTTP_HOST']);
    if(
    strpos($site_url,':')) $site_url substr($site_url,0,strpos($site_url,':'));

    if (
    $site_url == 'example.org'header('Location: http://www.example.org');
    elseif (
    $site_url!= 'www.example.org')
    {
    if(
    strpos($site_url,'example.org')) $host_length strlen('example.org');

    $user substr($site_url,0,strlen($site_url)-$host_length-1);

    header("Location: http://www.example.org/userpage_redirect.php?user=$user");

    No trees were harmed in the transmission of this message.
    However, a rather large number of electrons were temporarily
    inconvenienced.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •