How to ignore pageviews by search engines on a PHP page?

I have a specific PHP page that I want to conditionally do only if the visitor is not a search engine. Is there a suitable regular expression to match $_SERVER['HTTP_USER_AGENT']?

Or would it be better to redirect javascript to the page, but set the flag since search engines do not have javascript? (I don’t need to worry that my users do not have Javascript for this page.)

I don’t want to completely exclude search engines from page hits, so keep the robots.txt sentence.

+3
source share
1 answer

script .

.

+2

Source: https://habr.com/ru/post/1762795/


All Articles