I have a particular PHP 开发者_C百科page that I want to conditionally do things only if the visitor is not a search engine. Are there some good regex to match $_SERVER['HTTP_USER_AGENT']
?
Or would it be better to do a javascript redirect back to the page but set a flag, since search engines don't have javascript? (I don't have to worry much about my users not having Javascript for this page.)
I don't want to completely exclude search engines from hitting the page though, so save the robots.txt suggestion.
You have to use a browser detection script with an up to date user agent database.
Here is one.
精彩评论