I have got that link:
<a href="index.php">Political Science</a>
I put it dynamically with php code “include” as part of a header.. now, it doesnt work, that is because it depends where I am in the website directory.. sometimes I am two folders inside sometimes, I am at the root. .. henceforth, the value of the href attribute is incorrect when I am not in the root but in some folder.. it should be ../index.php..
How can I adapt that attribute to be ../index.php or index.php depending where I navigate in my site?
In situations like this, I usually assign an absolute path to the href attributes. I keep the address of my website in a variable and concatinate the website address with the relative location of the file (relative to the physical root of the website) like this:
and this never fails