Reputation: 573
This is the hierarchy of my folder and files:
/website
/admin
/about
editAbout.php
adminHeader.php
adminDashboard.php
adminLogout.php
adminHeader.php
is the header of my pages, so it is being included in all pages. It also contains the Logout link that has this code:
<a href="adminLogout.php">Logout</a>
In adminDashboard.php page it works, but in editAbout.php page, it didn't work because the link is not right, it becomes
http://www.domainname.com/admin/about/adminLogout.php
I tried to change the link to
<a href="http://www.domainname.com/admin/adminLogout.php">
and also by using the $_SERVER['DOCUMENT_ROOT']
but didn't work also.
Does anyone know how to reset the link to the right one?
Upvotes: 0
Views: 1938
Reputation: 317
You do not need to add the server name, as the browser will put that in for you. So just make all of your paths absolute (from the web browser's point of view):
/admin/adminLogout.php
Example:
<a href="/admin/adminLogout.php">
Upvotes: 1
Reputation: 2009
Try this:
$_SERVER['SERVER_NAME'] . "/admin/adminLogout.php";
The SERVER_NAME value refers to the domain.
Upvotes: 1
Reputation: 245
you can use ../ to come back to the parent folder
it becomes enter code here
Logout
Upvotes: 1