设置页眉,页脚和插件文件的正确路径

Ok so here is my folder layout:

Car
  -bower_components
  -includes
  -logs
  -public
     --admin
     --css
     --fonts
     --img
     --js
  -vendor

In the root folder I have paths.php:

<?php

//$glock=$_SERVER['HTTP_HOST'];


//if(!defined('ROOT')){define('ROOT',$_SERVER["DOCUMENT_ROOT"]);}
if(!defined('ROOT')){define('ROOT',__DIR__.'/');}
if(!defined('INCLUDES')){define('INCLUDES',ROOT.'includes');}
if(!defined('LOGS')){define('LOGS',ROOT.'logs');}
if(!defined('ADMIN')){define('ADMIN',ROOT.'public/admin');}
if(!defined('CSS')){define('CSS',ROOT.'public/css');}
if(!defined('FONTS')){define('FONTS',ROOT.'public/fonts');}
if(!defined('IMG')){define('IMG',ROOT.'public/img');}
if(!defined('JS')){define('JS',ROOT.'public/js');}

?>

I'm using a template system so that I can call my CSS and HTML files from anywhere. I've been failing to call my head-tag.php file, which is in includes, into my index.php file. Here is my index file:

<?php

include('paths.php');

echo "<html lang='en'>";
echo "  <head>";

        include('includes/head-tag.php');   
echo"   </head>";

echo "  <body>";
echo "  <header>";
         include('includes/header.php');
echo "    </header>";
?>   
<main>...

And here is head-tag.php:

        ...

        <!--Include all stylesheetes-->
        <link href=<?php echo CSS."/main.css"; ?> rel="stylesheet">
        <link href=<?php echo CSS."/bootstrap.css"; ?> rel="stylesheet">
        <link href=<?php echo CSS."/carousel.css"; ?> rel="stylesheet">
        <link href=<?php echo CSS."/cars.css"; ?> rel="stylesheet">
        <link href=<?php echo CSS."/footer.css"; ?> rel="stylesheet">
        <link href=<?php echo CSS."/loader.css"; ?> rel="stylesheet">

        <!--DateTimePicker JS includes-->
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script>
        <script type="text/javascript" src="bower_components/moment/min/moment.min.js"></script>
        <script type="text/javascript" src="bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>

I've tried echoing the paths in my head-tag.php file, but it only gives me the file directory, and not the one on the server, which generates a "Not allowed to load local resource" error. I know I'm doing something wrong here but I can't pin it down. I've been trying for over 24 hours now. In my paths.php file, I've tried using str_replace() to get rid of the "C:/..." and replace it with "localhost:8080..." but it didn't work, unless I was doing it wrong, I don't know. Any suggestions? Something tells me I'll have to define the paths again in my head-tag.php file, which I'm kinda trying to avoid.

TL;DR How do I get head-tag.php to echo "localhost:8080..." instead of file:///C:/wamp64/www/..."

UPDATE: I sorta solved this initial problem but now I have a new one. I answered my own question below and presented the new problem.

Ok I sorta kinda found the solution. In my paths file, instead of having if(!defined('ROOT')){define('ROOT',__DIR__.'/');}, I now have if(!defined('ROOT')){define('ROOT',dirname(dirname(htmlspecialchars($_SERVER['SERVER_NAME']))));}. Now when I try to access the header files from another php file which is not in the root, it doesn't work. I've found that the reason that happens is that it still determines the root from the file, which I thought I ran away from when I stopped using __DIR__and__FILE__. So how do I set the root folder to be constant, no matter which file/folder I'm calling from?