I don't have time do that right now. It would be easier to help you if you created a test on your server and linked to it for us to view.
I can show you some examples of what I am talking about that should help.
Start with https://github.com/onokumus/metismenu/blob/master/demo/mm-event2.html
Line 21 <script src="https://unpkg.com/metismenu"></script>
Try and surf to that link and you end up at https://email@example.com/dist/metisMenu.min.js. That is probably the actual link that should be at.
Lines 597 and 598
<script src="https://cdn.jsdelivr.net/npm/jump.js"></script> <script src="assets/js/mm-event2.js"></script>
Notice the first line is for the full link. No matter what your own url structure is, jump.js will always be available. This will not be true for the 2nd link. That may work for yourdomain.com if the assets folder is top level. But once your structure goes to yourdomain.com/somethingelse/ it will break because it is amused that assets/ is at the same level.
What you need to do is give the full link or absolute. In other words
Check your html to make sure that all the js and css files are either full links or absolute.
While a good suggestion, that does not help in the matter and it will be the same issue.
The takeaway is you have to adjust the links to your linked css and js files if you use the demo html files.
<?php include '.../header.php'; ?>
lenamtl, this is not a php topic, it is html.
What you are proposing in your code will open up for another set of issues that will depend on how include path is set up. I think this just confuses the issue.
This is an issue about linking css and js files using relative vs absolute paths.