There are people who like to mirror sites by pointing domain probably and waste the bandwidth from the server, so I want to redirect mirrored users to the real one
I tried with...
if ($_SERVER['SERVER_NAME'] != 'www.example.com')
{
header('Location: http://www.example.com');
exit;
}
...but the problem is that some people use str_replace
to fight this.
Then www.example.com
part becomes same as their mirror site, hence it's the same as $_SERVER['SERVER_NAME']
and it won't work.