freakretard Posted September 19, 2007 Share Posted September 19, 2007 Hi, I have a website hosted on a plan that supports multiple domains, but does not allow it to point to different content for each domain. I would like to know if it is possible to seperate the content for each domain by using php code. The logic would work something like this: PHP Read the domain name as typed in address bar if "www.domain1.com" echo page1.html elseif "www.domain2.com" echo page2.html /PHP Cant this work? What would the code be? Excuse me for any incompetence here, it has been years since I have used PHP. I dont know if there are any easier ways to acheive the result. I do not seem to have access to a .htaccess file and I wouldnt know what to do anyway. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/69873-multiple-domains-seperate-content-through-code/ Share on other sites More sharing options...
trq Posted September 19, 2007 Share Posted September 19, 2007 Much better if you did have access to mod_rewrite but within php you could simply use.... <?php switch ($_SERVER['SERVER_NAME']) { case 'foo.com': include 'foo.php'; break; case 'bar.com': include 'bar.php'; break; } ?> Link to comment https://forums.phpfreaks.com/topic/69873-multiple-domains-seperate-content-through-code/#findComment-350974 Share on other sites More sharing options...
freakretard Posted September 19, 2007 Author Share Posted September 19, 2007 Perfect. Thanks for that. Any tips on how I would go about doing a mod rewrite if it were possible with the hosting account I have? Link to comment https://forums.phpfreaks.com/topic/69873-multiple-domains-seperate-content-through-code/#findComment-350976 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.