I have created a PHP password protected site with log-in page. I am using the following link for logging out.
<a href="admin.php?action=logout"?>Log out</a>
The problem is it redirects back to the index.php, but instead of showing my URL as EXAMPLE.com it shows my URL as EXAMPLE.com/index.php, which is undesirable. How can I accomplish a log-out and go back to the clean, desired url.
In logout page you just add this redirect at the end of code
header("Location:http://www.example.com/");
This will redirect to the same index page with url example.com, but not show /index in url
Don't add
header("Location:http://www.example.com/index");
It will show example.com/index in url
After logout redirect using the following command:
header("Location:http://www.example.com/login.php");
You can also do it by javascript in client side by using:
window.location='http://example.com/login.php'