a级毛片在线观看,精品久久久久久亚洲精品,人人妻人人澡人人爽欧美一区九九 ,国产午夜视频在线观看

Web Design
Mobile Internet
Brand Design
Innovative
News
Encyclopedias

WordPress搜索引擎seo網站優化爬行記錄代碼

Date:2012-01-21 Aource:尚品中國 Type:網站百科
Word Size:small  medium  big

 WordPress搜索引擎seo網站優化爬行記錄代碼

寫博客也有一段時間了,(北京網站建設)為什么搜索引擎遲遲不收錄你的頁面呢?想知道每天都有哪些蜘蛛“拜訪”你的網站嗎?作為一名wordpress用戶(北京網站制作),有必要知道每天都有哪些蜘蛛爬行過你的網站,以便于了解各搜索引擎蜘蛛爬行頻率,對網站進行針對性的SEO網站優化

其實很簡單,只要添加以下代碼,然后再調用文件代碼就OK了,是不是很方便呢?那就開始行動吧。

之前我也找過幾個蜘蛛爬行記錄工具PHP版,結果都不盡人意。而且這些PHP程序大多要進行安裝,還要將蜘蛛爬行記錄添加到MYSQL中,未免太麻煩。那就尋找一個簡易的蜘蛛爬行記錄器吧~

googlebot

1.首先,在wordpress主題根目錄建立一個robots.php文件,寫入以下內容:

<?php
function get_naps_bot()
{
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, ’googlebot’) !== false){
return ’Googlebot’;
}
if (strpos($useragent, ’msnbot’) !== false){
return ’MSNbot’;
}
if (strpos($useragent, ’slurp’) !== false){
return ’Yahoobot’;
}
if (strpos($useragent, ’baiduspider’) !== false){
return ’Baiduspider’;
}
if (strpos($useragent, ’sohu-search’) !== false){
return ’Sohubot’;
}
if (strpos($useragent, ’lycos’) !== false){
return ’Lycos’;
}
if (strpos($useragent, ’robozilla’) !== false){
return ’Robozilla’;
}
return false;
}
function nowtime(){
$date=gmdate(”Y-n-j H:i:s”,time()+8*3600);
return $date;
}
$searchbot = get_naps_bot();
if ($searchbot) {
$tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
$url=$_SERVER['HTTP_REFERER'];
$file=”robotslogs.txt”;
$time=nowtime();
$data=fopen($file,”a”);
fwrite($data,”Time:$time robot:$searchbot URL:$tlc_thispage\n”);
fclose($data);
}
?>

將其上傳于你的主題目錄內。

2.在Footer.php或header.php的適當位置添加以下代碼調用robots.php。

<?php include(’robots.php’) ?>

程序原理:通過對蜘蛛標識符(如Baiduspider、Googlebot)的判斷,記錄蜘蛛爬行時間,并生成日志文件robotslogs.txt于根目錄。

程序缺點:無法記錄蜘蛛爬行的頁面,功能較為簡單。

?

Please contact our consultant

+86 10-60259772

Please provide your contact number. The project manager of shangpin China will contact you as soon as possible.