兑现蜘蛛捕捉的PHP代码
实现蜘蛛捕捉的PHP代码
SEO(Search Engine Optimization),汉译为搜索引擎优化,为近年来较为流行的网络营销方式,主要目的是增加特定关键字的曝光率以增加网站的能见度,进而增加销售的机会。分为站外SEO和站内SEO两种。SEO的主要工作是通过了解各类搜索引擎如何抓取互联网页面、如何进行索引以及如何确定其对某一特定关键词的搜索结果排名等技术,来对网页进行相关的优化,使其提高搜索引擎排名,从而提高网站访问量,最终提升网站的销售能力或宣传能力的技术。
?
很多做seo的, 经常会问为什么我的页面没有被收录,为什么我的快照还是上个星期的,怎么百度还不更新我的站点。这些都是刚入门问的问题。做seo的人都知道,知道搜索引擎的规律很重要。你要知道蜘蛛是否来过你的站点,什么时候来 过,是哪家蜘蛛。这些都有利于你针对性的做优化。
很多服务器支持蜘蛛爬行日志,但是大部分站长都是虚拟机,有的空间并不支持记录蜘蛛爬行。这时候就需要我们编写代码来记录蜘蛛的活动规律。
在网上找了很多的代码都不能正确使用,或者功能不完善。
只要自己研究起来。总结出一下一套代码,百分百保证使用。
<?phpfunction 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=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=”robotslogs.txt”;$time=nowtime();$data=fopen($file,”a”);$PR=”$_SERVER[REQUEST_URI]“;fwrite($data,”Time:$time robot:$searchbot URL:$tlc_thispage\n page:$PR\r\n”);fclose($data);}?>
以上代码比网上流传的版本多了个记录搜索引擎请求页面记录,可以看到蜘蛛每次来爬取的是那个页面。更加利于分析蜘蛛对网站的权重以及对不同栏目和页 面的青睐。
Seo最终的是从实际出发,用数据说话,而不是凭空想象。一切优化的基础都是数据,一切优化的目的也是为了得到数据。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Vue3+TS+Vite development skills: How to perform SEO optimization SEO (SearchEngineOptimization) refers to optimizing the structure, content and keywords of the website to rank it higher in search engines, thereby increasing the website's traffic and exposure. . In the development of modern front-end technologies such as Vue3+TS+Vite, how to optimize SEO is a very important issue. This article will introduce some Vue3+TS+Vite development techniques and methods to help

The usage of return in C language is: 1. For functions whose return value type is void, you can use the return statement to end the execution of the function early; 2. For functions whose return value type is not void, the function of the return statement is to end the execution of the function. The result is returned to the caller; 3. End the execution of the function early. Inside the function, we can use the return statement to end the execution of the function early, even if the function does not return a value.

Source code: publicclassReturnFinallyDemo{publicstaticvoidmain(String[]args){System.out.println(case1());}publicstaticintcase1(){intx;try{x=1;returnx;}finally{x=3;}}}#Output The output of the above code can simply conclude: return is executed before finally. Let's take a look at what happens at the bytecode level. The following intercepts part of the bytecode of the case1 method, and compares the source code to annotate the meaning of each instruction in

What is a 301/302 redirect? How to redirect the website? This article will take you through 301/302 jumps, introduce the jump methods, and analyze them from the SEO perspective to see which method is practical. I hope it will be helpful to everyone!

SSR technology application practice in Vue3 to improve the SEO effect of applications. With the rapid development of front-end development, SPA (Single Page Application) has become mainstream. The benefits of SPA are self-evident and can provide a smooth user experience, but there are some challenges in terms of SEO (search engine optimization). Since SPA only returns an HTML template in the front-end rendering stage, most of the content is dynamically loaded through JavaScript, causing search engines to have difficulties in crawling, indexing, and ranking. To solve this problem,

With the continuous development of web technology, more and more websites are beginning to use Vue as the front-end framework. Although Vue can provide a good user experience and development efficiency, there are still some challenges in search engine optimization. This article will introduce how Vue performs SEO optimization and some practical suggestions. 1. Vue’s SEO issues Vue’s SEO issues mainly include the following points: Server-side rendering issues: Vue is a single-page application (SPA), which means that it is rendered in the browser through JavaScript

Summary of Vue development experience: Practice in solving SEO and search engine optimization In the current era of rapid development of mobile Internet and Web technology, search engines are still one of the most important ways to obtain information on the Internet. For websites that need to gain high exposure in search engines, SEO (SearchEngineOptimization) is an essential task. So, for web development projects using Vue technology, how to achieve SEO and search engine optimization? Vue

The difference between SEO and SEM is 1. SEO refers to search engine optimization, while SEM refers to search engine marketing; 2. SEO optimizes the visibility of the website so that it naturally ranks in front of organic search results, while SEM uses advertising to Paid ranking at the top of search results; 3. SEO is a long-term strategy, which requires continuous and sustained efforts to maintain the website's ranking in search engines, while SEM can be flexibly adjusted and implemented, and it can quickly adjust the advertising strategy as needed. and budget.
