Results 1 to 3 of 3

Thread: sub-domain: where does my index.htm go?

  1. #1
    Join Date
    Apr 2011
    Posts
    3

    Default sub-domain: where does my index.htm go?

    Perhaps this will be obvious when I define my sub-domains, but my searches in this forum and others come up empty.

    Assume my primary domain is http://www.example.org and I create a http://subdomain.example.org.

    Into the Firefox address-block my user enters : "http://subdomain.example.org".

    Where will it find (i.e where do I need to create) the index.htm or equivalent for subdomain.example.com?

    I have found the following (seemingly overcomplicated) script which I gather would be coded into the existing index.php for the main directory . Is this what I need to do?
    -- source: http://www.webmasterworld.com/php8746.htm. Assuming PHP script. --

    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");
    }

  2. #2
    Join Date
    Apr 2008
    Location
    Morgan Hill, CA
    Posts
    974

    Default

    When you create a new subdomain, you are prompted to specify a directory for it. Just place your index.html file for the subdomain into whatever directory name you've chosen for the subdomain. (While I'm not really sure what that example from webmasterworld is doing, you certainly don't need to do all that to create and use a subdomain.)

  3. #3
    Join Date
    Apr 2011
    Posts
    3

    Default

    Thanks Bob.

Posting Permissions

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