How does a WordPress blog record search engine spider crawling traces?

Source: Internet
Author: User
Tags wordpress blog

WordPress blog record seo/seo.html "target =" _ blank "> search engine spider crawling trace plug-in:

1. The Spider Tracker plug-in of the search engine Spider crawling recorder can record the Spider crawling traces of Baidu, Google, Yahoo, Bing, Sogou, and search engines and generate statistical charts, we can clearly see the number of spider search engines in the last six days, and the time when the spider came to the station and crawled the Web sites.

2. wp-log-robots plug-in size is only 3 KB, wp-log-robots is a WordPress plug-in that records search engine spider activity records, the plug-in main file only has one wp-log-robots.php. The key is that its statistics are recorded in text files instead of being added to the database. For example, if your blog address is: http://www.111cn.net, then the storage location of the robot log file is:/robots_log.txt. We only need to add this address to the search folder, so that we can easily view the crawling status of each search engine.

In the blog background plug-in-install plug-in-search "wp-log-robots"-click Install now, and then enable the plug-in on the plug-in page, no need to set, the crawling records of search engine robots are recorded. (Note: When the plug-in is just started, the robots_log.txt file has not yet been created. It is a 404 page. This file will be created only after a search engine has arrived .)

WordPress blog records search engine spider crawling trace code:

1. First, create a robots. Php file in the wordpress topic root directory and write the following content:

The following search engines are supported:
Record the crawling websites of Baidu, Google, Bing, Yahoo, Soso, Sogou, and Yodao!
The php code is as follows:
Copy the code as follows:

The code is as follows: Copy code

<? Php
Function get_naps_bot ()
{
$ Useragent = strtolower ($ _ SERVER ['http _ USER_AGENT ']);
If (strpos ($ useragent, 'googlebot ')! = False ){
Return 'Google ';
}
If (strpos ($ useragent, 'baidider Ider ')! = False ){
Return 'baidu ';
}
If (strpos ($ useragent, 'msnbot ')! = False ){
Return 'bin ';
}
If (strpos ($ useragent, 'slurp ')! = False ){
Return 'Yahoo ';
}
If (strpos ($ useragent, 'sosospider ')! = False ){
Return 'sososo ';
}
If (strpos ($ useragent, 'sogou spider ')! = False ){
Return 'sogou ';
}
If (strpos ($ useragent, 'yodaobot ')! = False ){
Return 'yodao ';
}
Return false;
}
Function nowtime (){
$ Date = date ("Y-m-d.G: I: s ");
Return $ date;
}
$ Searchbot = get_naps_bot ();
If ($ searchbot ){
$ Tlc_thispage = addslashes ($ _ SERVER ['http _ USER_AGENT ']);
$ Url = $ _ SERVER ['http _ referer'];
$ File = "www.111cn.net.txt ";
$ Time = nowtime ();
$ Data = fopen ($ file, "");
Fwrite ($ data, "Time: $ time robot: $ searchbot URL: $ tlc_thispagen ");
Fclose ($ data );
}
// Collect http://www.111cn.net
?>

 


Upload it to your topic directory.

2. Add the following code to call robots. php in the proper position of Footer. php or header. php.

View source code print help 1 <? Php include ('Robots. Php')?>


Program principle: through the identification of the Spider (such as baiduspider、botnet), record the spider crawling time, and generate the log file robotslogs.txt in the root directory.

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.