Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 647

i couldn't redirect to the admin.html page after the login.php validated my input in the login page

$
0
0

This is my folder setup - note that login.php is found inside the login folder:

htdocs└── HRMS└── Home└── login├── admin│└── admin.html└── employee└── employee.html

After I enter the role and password the login.php validates it and if its correct it should redirect to the respective page either admin.html or employee.html - but my problem is that it doesn't do that. Instead localhost gives this error

Not Found The requested URL was not found on this server.

Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 Server at localhostPort 80

Here is part of the login.php code:

// Redirect based on roleif ($users[$role]['role'] === 'admin') {  header('Location:http://localhost/HRMS/Home/login/admin.html'); // Absolute URL  exit();} elseif ($users[$role]['role'] === 'employee') {  header('Location:/HRMS/Home/login/employee/employee.html'); // Absolute URL  exit();}else {  echo "Invalid role!";}

N.B.: it works manually, but it is not working directly from the login.php.

I even tried:

header('Location:http://localhost/HRMS/Home/login/admin/admin.html');

It was supposed to open the admin.html page when I enter the admin password but instead it shows the 404 error


Viewing all articles
Browse latest Browse all 647

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>