Ad

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?

Ad

Answer

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

Ad
source: stackoverflow.com
Ad