-->

How to redirect traffic that comes from certain do

2019-09-19 00:10发布

问题:

I need to redirect traffic for all the visitors coming from a bunch of domains, but they all have the same page.

So all referrers like this:

hxxp://domain1.com/search.php
hxxp://domain2.com/search.php
hxxp://domain3.com/search.php

So when these visitors come to my page, they will be redirected through another url, however all other referring visitors will go to the site.

Ideas?

回答1:

In your .htaccess file, assuming YourNewDestination.com is the desired destination:

RewriteEngine on
RewriteCond %{HTTP_REFERER} /search\.php$ [NC]
RewriteRule ^(.*)$ http://YourNewDestination.com


标签: referer