开发者

does a PHP redirection affects the way a crawler or a robot views a website?

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.


See http://www.theinternetdigest.net/archive/301-redirects-seo.html and http://jesperastrom.com/seo-301/different-variations-of-redirects-301-302-303-304-etc/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜