技术文章 — 网站技术文章

Article
[打印本页] [关闭本页] [返回列表页] [返回首页]

PR劫持的方法(ASP & PHP 301重定向篇)

分类:网站技术文章 发布时间:2008年7月14日 作者:风山渐 点击:
PR马上要更新了,奉上ASP与PHP的pr劫持代码,分享给大家学习,但是不要用在不正当的地方哦!

首先是ASP版:http://www.qudou8.com/ 是我要劫持的pr站

  1. user_agent = Request.ServerVariables("HTTP_USER_AGENT")   
  2. if user_agent = "Googlebot" then '则判定访问google   
  3.  Response.Status = "301 Moved Permanently"  
  4.  Response.AddHeader "Location""http://www.qudou8.com/"  
  5. end if  


接下来是PHP版:http://www.sseoo.com/ 是我要劫持的pr站
  1. if (strstr($_SERVER["HTTP_USER_AGENT"],"Googlebot")) {   
  2.     header("HTTP/1.1 301 Moved Permanently");   
  3.     header("Location: http://www.sseoo.com/");   
  4. exit;   
  5. }   
  6. else {   
  7.     header("Content-Type: text/html; charset=ISO-8859-1");   
  8. };  

关于PR劫持:
通过301重定向可以让google误认为重定向的站为当前域名站,故可以将重定向站的PR劫持,使下次PR更新自己的站与指定站PR一致,不过此PR不是真实的PR,就是好看!
[打印本页] [关闭本页] [返回列表页] [返回首页]