I'm looking for a solution to prevent redirection from an external website to my domain. Let's say, I have a domain call abcd.com and I found another domain call xyz.biz is redirected their all traffic to my domain. I wanted to stop that queries/redirection that comes from xyz.biz
I'm using IIS8/Windows Server 2012 and tried following configurations but no luck.
Option 1: I have added below HTTP_REFERER script in web.config file but still it accepts that redirection request.
<rule name="DenyAccess" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{HTTP_REFERER}" pattern="xyz.biz" />
<add input="{HTTP_REFERER}" pattern="www.xyz.biz" />
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
Option 2: I tried to add following PHP script in index.php file but it didn't work.
$ref=$_SERVER['HTTP_REFERER'];
if($ref=="http://xyz.biz" || $ref=="http://www.xyz.biz"){
exit();
}
When I do echo $_SERVER['HTTP_REFERER'] then it returns empty results and couldn't see any details captured from xyz.biz
Can anyone suggest an idea how we can approach this issue? Thanks in advance.