I have a particular PHP 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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.