I am facing this weird problem in my localhost. I have a directory in htcdocs named sdis. I have included all the files using DOCUMENT_ROOT in the files placed under the root folder. All the css, links, images, etc. show up fine. Now, when I add a subfolder under sdis and try to include the same, I get a raw page without any css. This is the code for both root folder files, as well as subroot folder files.
<?php include $_SERVER["DOCUMENT_ROOT"].'/sdis/includes/overall/header.php'; ?>
Whatever Data
<?php include $_SERVER["DOCUMENT_ROOT"].'/sdis/includes/overall/footer.php'; ?>
And after a lot of playing around, I realized, the link href part is something like:
href="bootstrap/css/bootstrap.css"
Now that, is not an absolute link of course. Hence the including DOCUMENT_ROOT is working only for the root folder files. So I tried using both of these:
<link rel="stylesheet" type="text/css" href="<?php echo $_SERVER['SERVER_NAME'] ?>/bootstrap/css/bootstrap.min.css">
and
<link rel="stylesheet" type="text/css" href="<?php echo $_SERVER['DOCUMENT_ROOT'] ?>/bootstrap/css/bootstrap.min.css">
And it still doesn't show up any css or images for the files in subroot folder.
Could anyone help me out including the css links, images, etc, so that all the css and images shows in the root folders, subfolders, etc. too properly?