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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.