How Can I Redirect Users Coming From A Google Search, But Not Google Crawler For The Same Page?

- 1 answer

I wondered if there is a way to redirect users that come from a Google search to my homepage when the ranked page isn't the homepage, without interfering the good ranking for that page.

What I need is a php condition to understand if the webpage is reached from a user that comes from a Google search and not from the Google crawler. I need Google crawler to continue indexing that page, and at the same time, users to be redirected to the homepage. This is a pseudocode snipped of what I mean:

if ($_SERVER['HTTP_REFERER'] == 'only users from a Google search') 


Don't use any of these techniques, you should treat Google like any user, don't add any filters or conditions in your code.

We call this technique cloaking, its one of the most dangerous spam techniques and Google will penalize you.