I currently have a website that was thrown together w/o planning and I am now trying to begin organizing it a little better. The issue I'm having is that I want to move some of the pages into subdirectories, but other pages (such as the main page) will still remain in the root directory. I have a directory called includes that holds the header file, footer file, and navigation files which are included in all pages within the site. My problem is that when I am on a page within the root directory, or a page within the sub directory, the path's need to be different for the links and image files.
For instance, if a page in the root directory is displayed to link to another page I can just link to "example.php", but if i'm on a page within a subdirectory the link needs to be "../example.php".
Only using one file to hold all the link information, is there a simple way to do this?