开发者

can a php piece of code that block old browsers from accessing a website block search engine spiders?

i was looking for a way to block old browsers from accessing the contents of a page because the page isn't compatible with old browsers like IE 6.0 and to return a message saying that the browser is outdated and that an upgrade is needed to see that webpage.

i know a bit of php and doing a little script that serves this purpose isn't hard, then i was just about to start do开发者_运维知识库ing it and a huge question popped up in my mind.

if i do a php script that blocks browsers based on their name and version is it impossible that this may block some search engine spiders or something?

i was thinking about doing the browser identification via this function: http://php.net/manual/en/function.get-browser.php

a crawler will probably be identified as a crawler but is it impossible that the crawler supplies some kind of browser name and version?

if nobody tested this stuff before or played a bit with this kind of functions i will probably not risk it, or i will make a testfolder inside a website to see if the pages there get indexed and if not i abandon this idea or i will try to modify it in a way that it works but to save me the trouble i figured it would be best to ask around and because i didn't found this info after a lot of searching.


No, it shouldn't affect any of major crawlers. get_browser() relies on the User-Agent string sent with the request, and thus it shouldn't be a problem for crawlers, which happen to use custom user-agent strings (eg: Google's spiders will have "Google" in their names).

Now, I personally think it's a bit unfriendly to completely block a website to someone with IE. I'd just put a red banner above saying "Site might not function correctly. Please update your browser or get a new one" or something to that effect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜