Redirct search engine bots to another url

helo any solution to redirct only search engine bots to another url in Cloudflare free plan

Any specific like Google, Bing, or some other? :thinking:

I’d say using a Transform Rules to catch a request where User-Agent contains a part of that search engine bot, therefore using the rewrite option to some “test-path”, therefore followed by a Page Rule which matches that particular request which contains “test-path” URL to redirect it to the desired URL.

You can combine multiple at once to catch Bingbot, Googlebot, Petalbot, etc. as you want or need, if so.

Steps:

  1. Navigate to the Cloudflare dashboard
  2. Go to the Rules tab and select Transform Rules
  3. Click on the blue button “Create transform rule” → from the dropdown menu select “URL Rewrite”
  4. Give a rule the name as desired
  5. From the Field dropdown, select “User-agent”
  6. From the Operator dropdown, select “contains”
  7. In the input field Value, write Google or some other
  8. From below, check the “Rewrite to…” checkbox
  9. Select “Static”, therefore followed by / (slash), in the input field enter something like Cloudflare-user-agent-redirect
  10. For Query, select “Preserve”
  11. Click on the blue button “Save”.
  12. You would be navigated back to the Transform Rules
  13. Click on the “URL Rewrite” section to see the listed URL we have just created and make sure it’s active (green color -
    toggle)
  14. From the left sidebar navigation, click on the “Page Rules” menu item
  15. Click on the blue button “Create Page Rule”
  16. In the URL field, enter https://yourdomain.com/cloudflare-user-agent-redirect*
  17. From “Pick a setting” select “Forwarding URL”
  18. In the input field next to it, from the dropdown select “301 - Permanent Redirect”.
  19. In the “Enter destination URL” enter your desired URL to which the user with MSIE 8.0 User-agent should be redirected
  20. Click on the blue button “Save Page Rule” to save it.
  21. You’d be navigated back to the Page Rules, make sure the newly created Page Rule is active (green color - toggle)

I tested the above and it is working on my test domain. I believe it should work on your domain too.

I am just attaching a screenshot for easier navigation and help to make it possible as simply as it could be achieved by using
Cloudflare.

In picture as an example described using the above steps:

Helpful articles:

2 Likes

… or just use a Dynamic Redirect and do it all in one rule :slight_smile: User-agent = Google, static redirect to …

3 Likes

hi there
how i can use rediret expired domain for my website anyone can guide

Thanks. Now can you tell me if there is a way to keep Google to browse on my site while all the other legit users are redirect on another domain, including pages? not pointing everyone to a single page, everyone should keep browsing normally just on a different domain… except Google that remain on the old domain

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.