grnadpa
09-17-2011, 06:44 AM
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. --
$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");
}
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. --
$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");
}