Search code examples
.htaccesshttp-redirectseouser-agentgooglebot

How to hide redirect from the one of the User-Agents


I have an URL and I want to have this configuration for it:

  • Googlebot should be redirected to page x,
  • other User-Agent should be redirected to page y.

How can I hide the 301 redirect from Googlebot and redirect this url to other adress? Should I edit .htaccess?


Solution

  • You could probably do this using rewrite conditions and rules:

    RewriteCond %{HTTP_USER_AGENT} Googlebot
    RewriteRule ^mypage /redirect [L,R=301]
    

    So this would redirect requests with a user agent that contains the word Googlebot from http://example.com/mypage to http://example.com/redirect