4
I’m working on a project and function header
cannot locate the destination passed to it. I have the following folder structure:
On a certain form, I pass a action
for:
<form method="post" action="index.php?pagina=../controller/controllerCategoria">
So far so good, but what I would like is that when I arrived in this file, I could return to a file inside the admin
.
I was trying with the following header
:
header('Location:http://localhost/tecmidiaCor/admin/index.php?pagina=criarPaginas');
In that case I wanted to go back to the file criarPaginas.php
.
I didn’t point out PHP
why in my index.php
I have a script that always assigns the contents of the page variable.
There’s a gap between
Location:
and the rest of the URL. Also, as far as I know you cannot specify a query in the fieldLocation
. Otherwise, make sure the path exists. And if you want, you can remove the schema and the domain, leaving only the path itself.– Vinícius Gobbo A. de Oliveira
the question of space is not, the rest I did not understand what you put
– André Martins
for example I put the full file address locally, even though it doesn’t work, header('Location: /Users/andremartins/Developer/workspaces/php/tecmidiaCor/admin/index.php');
– André Martins
First of all, take a look at how the HTTP protocol works, at least on Wikipedia. The physical path of the file doesn’t work. The server can only serve files that are in the same subtree as the
DocumentRoot
(in the case of Apache). Assuming yourDocumentRoot
be it/Users/andremartins/developer/workspaces/php/
, you can test withLocation: /tecmidiaCor/admin/index.php
.– Vinícius Gobbo A. de Oliveira