I am new to php and understand that this is quite a common problem. I have read a lot of related issues over the net and here at stack overflow however I have not been able to successfully implement them.
I have a project with a directory structure like so:
Project/
includes/
header.php
footer.php
sidebar.php
css/
style.css
index.php
blog/
index.php
Within the index.php in the root I pull in the includes like so:
include 'includes/header.php';
And the css file in the header.php like so:
<link rel="stylesheet" href="css/style.css">
Now this works on the index.php file in the root and any other file placed within the root. However it breaks for all pages within a sub folder for example the blog/index.php
My main question is how can i properly reference my css files and my includes in a project so that the files are accessible to second level pages as well?
Notes:
- I am working on a local server
- All project files are contained within a PROJECT folder in the root - (localhost:8888/Project/index.php)
Any help will be much appreciated.
Thank you.