Yes, you can do this. In the script below, I read the sub-directory from a MYSQL database. This is overkill for just a few domains, but great for a hundred.
This is index.html file: <?php $conn = mysql_connect("localhost","username","password"); mysql_select_db("mydatabase",$conn) or die("Error: ".mysql_error()); list($subd,$domain,$tld) = explode(".",$HTTP_SERVER_VARS['HTTP_HOST']); if( $tld == "" ) { $tld = $domain; $domain = $subd; $subd = "www"; } $query = "SELECT directory FROM subdomains WHERE subdomain =\"$subd\" && domain=\"$domain\""; $results = mysql_query($query) or die("Error: ".mysql_error()."<BR>$query<BR>"); if( mysql_num_rows($results)<>1 ) { print "Error: Cannot find sub-domain ".$HTTP_SERVER_VARS['HTTP_HOST']."<BR>"; exit; } else { $row = mysql_fetch_array($results); $loc = "http://www.mydomain.com/".$row['directory']; header( "location: $loc"); } exit; ?> -----Original Message----- From: Leif K-Brooks To: [EMAIL PROTECTED] Sent: 2/13/02 8:37 PM Subject: [PHP] Is this possible? I would like to have multiple domains and have them forwarded to different folders, so I'd only need one hosting account. Example: www.domain1.com goes to www.domain.com/domain1 www.domain2.com goes to www.domain.com/domain2 I would like to do this in php. Of course, to do this, I'd need to get the url the user is requesting into the script. If this possible? Thanks in advance, Leif K-Brooks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php