문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top