Jump to content


Absolute Includes / Multiple Virtual Hosts

  • Please log in to reply
No replies to this topic

#1 jkies00

  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 25 May 2006 - 01:09 AM

Hi All,

I've really been banging my head on the wall with this one. WHen I built my first PHP site a few months ago, I used this little snippet to handle my includes:

<?php include($_SERVER["DOCUMENT_ROOT"].'/_includes/components/header.php'); ?>

It worked perfectly - any page in any directory could use the same code to get to the include.

Now I have another PHP site to build, so I set up two Virtual Hosts in Apache. Each site now lives in its own directory within the htdocs directory. But now, my nice include code, above, no longer works. The code above resolves to the htdocs directory, instead of the the Virtual Host directory.

How can I code my includes to resolve to the root of the Virtual Host directory? Please help!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users