Im creating website using PHP for the backend. I created a "Common" folder that stores my navigation bar that i'll be using throughout the application. In the navigation bar there are links that redirect users to different pages of the website. The pages the user will be directed to are in different folders and subfolders of their own. When i click on the navbar link, it redirects to the page. Thereafter, when i click on another navbar link from that page i get a "Object not found" error.
These are the main links:
<li class="nav-item">
<a class="nav-link" href="Views/view_Catalogue.php">PRODUCTS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Views/view_BecomeCustomer.php">BECOME A CUSTOMER</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Views/view_MakeAnOrder.php">MAKE AN ORDER</a>
This is the include of the pages:
<?php
include('../Common/Header.php');
include('../Common/NavigationBar.php');
?>
These are the file directories: https://i.stack.imgur.com/p9dA7.png https://i.stack.imgur.com/wrp5S.png
These are the URLs and before and after i get the error:
Website starts on the index page: myphp/Ticototrading/index.php
When i click a link it redirects the user to: myphp/Ticototrading/Views/view_BecomeCustomer.php
And then, when i click on the home link(or any navlink) on the navbar again i get the "Object not found" error and i noticed the problem lies with the file path that has changed to: myphp/Ticototrading/Views/index.php
When I redirect to a different page, the current page adds its folder to the file path instead of going directly to the href="" given.