php - Base Directory changes when a slash is added to URL

I have a standard PhP website with a 3 files and a stylesheet for each one of those, inside a style folder. The files are these:
header.php
index.php
footer.php
I've made it as such so i can easily call the header and footer onto any page as i require it.
My problem is that, if i add a forward slash to the end of the URL, it changes the base folder, causing the stylesheet file to not be found as showed in the images attached. Basically, it starts looking for "style/header.css" inside of the index folder, which doesnt even exist, hence can't find the CSS file, if i am understanding it correctly. I have an htaccess file to remove the .php extensions from the URL, but i tried without it and got the same error.
I have read that using a absolute paths will help, but this is not going to be hosted anywhere so i'm not entirely sure how it will help my case.
This is the head tag on my header, which includes all the links
<head>
<meta name="description" content="website" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="img/logo/logo3.png" type="image/x-icon">
<link rel="stylesheet" href="style/header.css" />
<link rel="stylesheet" href="style/extras.css" />
<link rel="stylesheet" href="style/style.css" />
<link rel="stylesheet" href="style/footer.css" />
<script src="js/header.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script src="https://kit.fontawesome.com/b076d05399.js"></script>
</head>
And i simply use these codes to call upon the header and footer accordingly.
<?php
require_once "header.php";
?>
content
<?php
require_once "footer.php";
?>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: apache/2.4.52 (win64) openssl/1.1.1m php/8.1.2 server at localhost port 80
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.