Foghladha
Foghladha

Reputation: 11

Identifying Traffic From Spoofed URL Redirect - PHP / Apache

Been rolling this around in my mind a few days. Here's the Situation.

A few weeks ago a person bought a similar domain name and set it to 301 Redirect to my actual page. He then used this to write software developers asking for press keys to their applications for review promising space in our publication.

What I would like is to make a special message appear whenever someone lands on my site from the specific URL redirect.

So IF User A Enters the Site at: example.org and gets redirected to example.com automatically the site serves a different page than User B.

User B Enters the Site directly at: example.com

This way I can tip developers off that they've been phished and to ignore the email they received and forward it to my real address so I can add it to the list of affected companies for the law enforcement agents.

System is a LAMP environment

Thanks in Advance!

Upvotes: 1

Views: 51

Answers (1)

usman zafar
usman zafar

Reputation: 230

What you looking is $_SERVER['HTTP_REFERER'], it works on most of the browser. So what you need to do is

if ( $_SERVER['HTTP_REFERER'] === 'put-referral-url-here.com')
{
//redirect to page b
header('Location: http://www.example.com/pageb.html');
}

Refer to documentation of Server Variable and further read on this

Upvotes: 2

Related Questions