There has to be something I'm overlooking but I can't seem to get my includes to work as expected using relative paths. In MAMP the DocumentRoot is configured in httpd.conf like this:
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
DocumentRoot "/Applications/MAMP/projects/journalproject”
I bring up the site at http://localhost:8888/ and the includes work fine if I use a path like this:
<?php include('nav.php'); ?>
But, if I put my include file into a folder, the include doesn't show up on the page:
<?php include('/includes/nav.php'); ?>
This is the path of the include file: /journalproject/includes/nav.php
I'm calling it from here: /journalproject/journals/index.php
I can also get the include to work if I use a path like this:
<?php include('../includes/nav.php'); ?>
I'm not sure why I need to specify the path for the include when an anchor link has no trouble finding the same file using a relative path:
<a href="/includes/nav.php">Find nav include</a>
I'm not sure where to go from here. Any help would be greatly appreciated.