PR劫持的方法
发布时间:2008年12月27日 文章分类:服务器技术 文章作者:Hitomi 浏览次数:次
PR马上要更新了,奉上ASP与PHP的pr劫持代码,分享给大家学习,但是不要用在不正当的地方哦!
首先是ASP版:http://www.qudou8.com/ 是我要劫持的pr站
ASP/Visual Basic代码
- user_agent = Request.ServerVariables("HTTP_USER_AGENT")
- if user_agent = "Googlebot" then '则判定访问google
- Response.Status = "301 Moved Permanently"
- Response.AddHeader "Location", "http://www.qudou8.com/"
- end if
接下来是PHP版:http://www.sseoo.com/ 是我要劫持的pr站
PHP代码
- if (strstr($_SERVER["HTTP_USER_AGENT"],"Googlebot")) {
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: http://www.sseoo.com/");
- exit;
- }
- else {
- header("Content-Type: text/html; charset=ISO-8859-1");
- };
关于PR劫持:通过301重定向可以让google误认为重定向的站为当前域名站,故可以将重定向站的PR劫持,使下次PR更新自己的站
与指定站PR一致,不过此PR不是真实的PR,就是好看!