Here is my root folder :
index.php
stylesheets(folder) --->main.css
includes(folder) --->header.php
folder1 (folder) --->page1.php
Here is link part of “header.php” (from includes folder) :
<link href="stylesheets/main.css" rel="stylesheet" type="text/css" />
Here is a part of index.php :
<?php include "includes/header.php"; ?>
Here is a part of page1.php (from folder1):
<?php include "../includes/header.php"; ?>
Problem is, when I open index.php everything is normal. As for /folder1/page1.php, it doesn’t see styles but see content of header.php. That is to say, it doesn’t bring main.css. Most probably, because of link href="stylesheets/main.css" rel="stylesheet" type="text/css" Any help?
Because you access files from multiple levels, you should use an absolute path.
So either
href="http://domain.com/stylesheets/main.css"orhref="/stylesheets/main.css"But this only works (the 2nd one, and the one I recommend) when you have it on top level on your domain.