The url are not the same as the one mentioned in the question
Look at the lines below:
Header:
header("Location:/views/painel.php");
Html
echo "<meta http-equiv='refresh' content='0;URL=views/painel.php' />";
Note that in header
you are adding a /
(bar ) before the URL. When you add this bar at the beginning, it means the user will have to be redirected to <raiz-do-projeto>/views/painel.php
Without the slash, you inform that the user should be redirected to the current URL + address informed. Ex:
Imagine that you are in the site administration area: https://www.example.com/admin/
When you access with the bar at the beginning (as it is in the header ), you are informing the user to be redirected to https://www.example.com/views/painel.php
When you access without the bar at the beginning (as it is in html ), you are informing the user to be redirected to%
Another error in your code is https://www.example.com/admin/views/painel.php
before echo
.
When you write something with Location
, echo
etc (or even there are "hidden" characters before opening the print
tag). <?php
can not modify the PHP
information.