了解什么是PR劫持我们才能最有效的防止PR劫持,今天和大家分享系ASP和PHP的PR劫持方法。。。。
首先是ASP版:x 是我要劫持的pr站
以下内容为程序代码:接下来是PHP版:x 是我要劫持的pr站
user_agent = Request.ServerVariables("HTTP_USER_AGENT")
if user_agent = "Googlebot" then '则判定访问google
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", x/
end if
以下内容为程序代码:关于PR劫持:
if (strstr($_SERVER["HTTP_USER_AGENT"],"Googlebot")) {
header("HTTP/1.1 301 Moved Permanently"); header("Location: x");
exit;
}
else {
header("Content-Type: text/html; charset=ISO-8859-1");
};