Pergunta

for example if in my index.php i have something like:

<?php
header('Location: /mypublicsite/index.php');
?>

what do the crawlers and/or robots get? just a blank page? or they actually arrive to /mypublicsite/index.php?

Foi útil?

Solução

Initially, they get a blank page, with a header saying they should load a different page instead. The client has to load the new page itself.

Robots do understand the Location directive, and will load the new page instead.

You have to understand though you should stop the execution of your php script yourself, because the Location header can be ignored.

So something like this:

<?php
header('Location: otherpage.php');
echo $secret;
?>

is unsafe, because $secret will be sent to the client.

Outras dicas

They arrive at the target of the redirection.

The header information of the document will be read by the crawler. The robot will go to the url because the location entry tells everybody to redirect to the given URL.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top