helo any solution to redirct only search engine bots to another url in Cloudflare free plan
Any specific like Google, Bing, or some other?
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:
- Navigate to the Cloudflare dashboard
- Go to the Rules tab and select Transform Rules
- Click on the blue button “Create transform rule” → from the dropdown menu select “URL Rewrite”
- Give a rule the name as desired
- From the Field dropdown, select “User-agent”
- From the Operator dropdown, select “contains”
- In the input field Value, write Google or some other
- From below, check the “Rewrite to…” checkbox
- Select “Static”, therefore followed by / (slash), in the input field enter something like Cloudflare-user-agent-redirect
- For Query, select “Preserve”
- Click on the blue button “Save”.
- You would be navigated back to the Transform Rules
- Click on the “URL Rewrite” section to see the listed URL we have just created and make sure it’s active (green color -
toggle) - From the left sidebar navigation, click on the “Page Rules” menu item
- Click on the blue button “Create Page Rule”
- In the URL field, enter
https://yourdomain.com/cloudflare-user-agent-redirect*
- From “Pick a setting” select “Forwarding URL”
- In the input field next to it, from the dropdown select “301 - Permanent Redirect”.
- In the “Enter destination URL” enter your desired URL to which the user with MSIE 8.0 User-agent should be redirected
- Click on the blue button “Save Page Rule” to save it.
- 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:
… or just use a Dynamic Redirect and do it all in one rule User-agent = Google, static redirect to …
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
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.