Place the snippet of code in an index.php file to pull up a different web page for each domain pointed to the same web-space.
<?
$serverName = $HTTP_HOST;
$serverName = str_replace("www.",& quot;",$serverName);
$serverName = str_replace(".com",& quot;",$serverName);
$serverName = str_replace(".net",& quot;",$serverName);
$serverName = str_replace(".org",& quot;",$serverName);
if (!(empty($serverName))) {
include("./".$server Name.".html");
}
?>
- sandip's blog
- Login or register to post comments
Comments
You can also serve domains pointed to the same server space to be directed to a particular sub-folder within the main hosting account using mod_rewrite rules:
Options +FollowSymLinks p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p; &nbs p;
RewriteEngine On &nbs
RewriteBase /
RewriteCond %{HTTP_HOST} domain_name.tld [NC]
RewriteCond %{REQUEST_URI} !folder_name/
RewriteRule ^(.*)$ folder_name/$1 [L]