If you are using MySQL, it will look something like this: localhost/folder/pages/task-form.php
Simply use as many ‘../’ as necessary to back out directories until you get to the destination that contains the main folder. in my example mentioned above, the file is 2 folders deep, so it requires 2 “../”
For this use:
<li><a href="../../folder/pages/task-form.php">Post Task</a></li>
For your example:
<li><a href="../pages/task-form.php">Post Task</a></li>
This will always take you to the main folder, then go to the destination of the file, even if youre already at it.
The way you were doing it was simply opening the destination folder, and the file again, while still being at the folder, thus creating a duplicate of the folder.
Important: You must use as many “../” as the deepest file you are accessing if it has a header.php linked to it. You can use 10 of “../” even if youre not 10 deep. It cant back out more than the most containing folder.