'PHP redirect if user is from google search

Can I detect if user clicked on my site from google chrome or google search and redirect them?

I know that I can detect Chrome user with this function:

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false{
//redirect
}

But is it possible to redirect user from other browser that is using google search? Maybe with googlebot IP?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source