Hosting multiple wesites in same webspace
Posted: Mon Jan 01, 2007 6:52 pm
Hi,
I have some webspace that I'm trying to use to host multiple websites - so I don't have to pay for additional hosting for each domain. I have 2 domain names that are pointing to the same webspace. I am a PHP novice, but did find some code that I have put in the index.php file that redirects to the appropriate site depending on what the user has typed in the address bar:
The problem with this is that the user who has gone to http://www.domain2.com sees that they have been redirected to http://www.domain1/folder2.
Instead of a redirection, is there any way with a combination of PHP and frames that I can read what URL the user has typed in the address bar and display the relevant page, but masking that they are looking at a subfolder of a differen domain?
In other words, the user who types in http://www.domain2.com must still see http://www.domain2.com in the address bar, even though they are looking at http://www.domain1/folder2.
Thanks.
I have some webspace that I'm trying to use to host multiple websites - so I don't have to pay for additional hosting for each domain. I have 2 domain names that are pointing to the same webspace. I am a PHP novice, but did find some code that I have put in the index.php file that redirects to the appropriate site depending on what the user has typed in the address bar:
Code: Select all
<?php
switch ($HTTP_HOST) {
case "www.domain1.com":
header("Location: http://www.domain1/folder1");
break;
case "www.domain2.com":
header("Location: http://www.domain1/folder2");
break;
}
?>Instead of a redirection, is there any way with a combination of PHP and frames that I can read what URL the user has typed in the address bar and display the relevant page, but masking that they are looking at a subfolder of a differen domain?
In other words, the user who types in http://www.domain2.com must still see http://www.domain2.com in the address bar, even though they are looking at http://www.domain1/folder2.
Thanks.