jkies00 Posted May 25, 2006 Share Posted May 25, 2006 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:[code]<?php include($_SERVER["DOCUMENT_ROOT"].'/_includes/components/header.php'); ?>[/code]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!Thanks,~jeff Quote Link to comment https://forums.phpfreaks.com/topic/10399-absolute-includes-multiple-virtual-hosts/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.