skip to Main Content

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') 
    header('location','index.php');

2

Answers


  1. Google crawler uses the user-agent as google bot, while other people would have user-agent set to there browsers. You can create a filter for the same and determine which request is for crawling and which is the actual request.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search