Jump to content

Multiple domains- seperate content through code


freakretard

Recommended Posts

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

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;
  }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.