I have included a 'header' file in files which are in root folder and the header file is in 'inc' folder. header.php is completely working when accessing from subdomain/main-website/index.php file. But when accessing from subdomain/index.php, only the logo is not showing due to the relative path.
Folder Structure: subdomain/main-website
- css
- img
- inc (header.php inside inc folder)
- index.php (
<?php include_once 'inc/header.php'?>) - about.php (
<?php include_once 'inc/header.php'?>)
subdomain
- main-website
- index.php (
<?php include_once 'main-website/inc/header.php'?>)
header.php
<div>
<img class="logoImg" src="img/logo.png" alt="" title="" />
</div>
<nav id="nav-menu-container">
<ul class="nav-menu">
<li class="menu-active"><a href="index.php">Home</a></li>
<li><a href="about-us.php">About Us</a></li>
</ul>
</nav>
So what should be done or what is the best approach for this.