1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Dynamic Subdomains

Discussion in 'Site & Server Administration' started by incdeveloper, Jun 23, 2007.

  1. #1
    Here is what i need and i dont know how to do it... :)

    I need to be able to create dynamic subdomains.. well to be more exact i need to be able to display information for a given user when i type his id on the subdomain ... so if i type incdeveloper.domain.com he displays my information... how can i do that?, i know i need .htaccess but i dont know how to do it

    thanks in advance
     
    incdeveloper, Jun 23, 2007 IP
  2. agnivo007

    agnivo007 Peon

    Messages:
    4,290
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Its called wildcarded subdomains...
    Done by adding the following DNS record:
    *.mysite.com. A ipnum.ipnum.ipnum.ipnum
     
    agnivo007, Jun 24, 2007 IP
  3. DeViAnThans3

    DeViAnThans3 Peon

    Messages:
    785
    Likes Received:
    83
    Best Answers:
    0
    Trophy Points:
    0
    #3
    To handle those wildcarded subdomains, you can use by example this php script.
    <?
    $host = $HTTP_HOST; 
    $names = explode(".", $host); 
    foreach($names as $name) { 
    // change "domain" to your domain and "com" to your TLD.
    if($name == "www" or $name == "domain" or $name == "com") { 
    continue; 
    } 
    else { 
    $actual_name = $name; 
    } 
    
    // $actual_name contains the subdomain.
    
    PHP:
    Cheers!
     
    DeViAnThans3, Jun 24, 2007 IP