Hosting Mutiple domains in a single webspace

Recently one of our design clients, a Western Colorado lawyer, purchased multiple domain names that contained keywords specific to his law practice and to the geographic locations where in he practices.

Instead of directing the domain names straight to his web site we decided to create a new web site for each domain name. Normally this would take a fair bit of time to create, and would not be affordable to our client.

So here’s a solution that we came up with.

We created a domain hosting record on our web hosting server that pointed to the same folder for each of the following domains:

We then create a PHP script that looks for a
domain name that is calling it.

The PHP script then displays the relevantly optimized
content that relates to a domain name, for example if the domain name was
www.vailcriminaldefenselawyer.com we optimized for criminal defense in Vail Colorado and the surrounding areas. The optimization included Alt tags, title
tags, keyword rich text, and Meta tags.

Below is the script, please feel free to use it and
change it as you feel fit.

Please leave a comment if you found this useful, or if
you have any suggestions on how you would have approached the same
problem. Oh and have a happy Christmas.

 

<?php

if ($_SERVER['HTTP_HOST'] == "www.glenwoodspringscriminaldefenseattorney.com" || $_SERVER['HTTP_HOST'] == "glenwoodspringscriminaldefenseattorney.com"){

include("glen.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.aspencoloradocriminalattorney.com" || $_SERVER['HTTP_HOST'] == "aspencoloradocriminalattorney.com"){

include("aspen.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.aspencoloradocriminallawyer.com" || $_SERVER['HTTP_HOST'] == "aspencoloradocriminallawyer.com"){

include("aspen.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.glenwoodspringscriminaldefenselawyer.com" || $_SERVER['HTTP_HOST'] == "glenwoodspringscriminaldefenselawyer.com"){

include("glen.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.westerncoloradocriminaldefenselawyer.com" || $_SERVER['HTTP_HOST'] == "westerncoloradocriminaldefenselawyer.com"){

include("west.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.eaglecriminaldefenselawyer.com" || $_SERVER['HTTP_HOST'] == "eaglecriminaldefenselawyer.com"){

include("eagle.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.aspencriminaldefenseattorney.com" || $_SERVER['HTTP_HOST'] == "aspencriminaldefenseattorney.com"){
include("aspen.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.aspencriminaldefenselawyer.com" || $_SERVER['HTTP_HOST'] == "aspencriminaldefenselawyer.com"){
include("aspen.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.glenwoodcriminaldefenselawyer.com" || $_SERVER['HTTP_HOST'] == "glenwoodcriminaldefenselawyer.com"){

include("glen.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.riflecriminalattorney.com" || $_SERVER['HTTP_HOST'] == "riflecriminalattorney.com"){

include("rifle.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.vailcriminaldefenselawyer.com" || $_SERVER['HTTP_HOST'] == "vailcriminaldefenselawyer.com"){

include("vail.php");

}elseif ($_SERVER['HTTP_HOST'] == "www.greggreerlaw.com" || $_SERVER['HTTP_HOST'] == "greggreerlaw.com"){

header(‘Location: http://www.greggreerlaw.com/’);

}

?>