How to redirect traffic that comes from certain domains, to a new url

£可爱£侵袭症+ 提交于 2020-02-06 08:34:49

问题


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


来源:https://stackoverflow.com/questions/35949427/how-to-redirect-traffic-that-comes-from-certain-domains-to-a-new-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!