I have had the same problem and have never really found a solution I was totally happy with.
I eventually decided to NOT use ../ to navigate in and out of directories when including files.
I think the following is the best solution:
Code:
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"); ?>
And for html within the header that references your pictures, do this:
Code:
<img src="/images/picture.jpg" alt="" width="258px" height="149px" />
src="/" When you start with the forward slash, you can build the file reference from the public web root (www or public_html). For example, you can link to index.php (the "home page") by simply doing this:
Code:
<a href="/">Link to home page</a>
If anyone else has any ideas about this I would love to hear them too. This is something I struggled with before until I came up with the above solution. But again, I am not convinced it is the best solution.
Good Luck,
Jason
Bookmarks