Redirect external website traffic to another website

Hi, there is a website sending specific traffic to mine, however, i want to redirect this specific traffic to another website.

What are you seeing in the request that shows it’s from the other website? There needs to be some criteria for initiating the redirect.

1 Like

Creating a page rule should work! For more information visit https://support.cloudflare.com/hc/en-us/articles/200172336-Creating-Page-Rules

Page rule It won’t to be working…

I need all traffic that comes to my site from www.samplesite.com (just an example) , set to be sent to another site (google.com for example).

In PageRules, I can’t set traffic coming from specified website to mine and redirect this specified traffic to another website.

And how, specifically, are you going to determine where traffic comes from?

Sorry, I wasn’t clear.

Using .htaccess it works fine, but website site gets slow.


#My website - www.mywebsite.com
#Coming traffic from www.sitesample.com
#Redirect to www.google.com

RewriteCond %{HTTP_HOST} ^mywebsite\.com [NC]
RewriteCond "%{HTTP_REFERER}" "!^$"
RewriteCond "%{HTTP_REFERER}" "!www.sitesample.com" [NC]
RewriteRule (.*) https://www.google.com [L,R=301]

How would I “reproduce” this in Cloudflare?

There we go, you’re looking at the Referer header.

You can create a Transform Rule to re-write the URL, then use a Page Rule that matches that new URL and do a Forwarding URL:

2 Likes

My friend, thank you so much for your kind help.
It’s working fine now!!!

Thank you very much for that.

1 Like

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