Welcome to WebmasterWorld Guest from

Forum Moderators: mack

Message Too Old, No Replies

Direct Access IP can cause hijacking issue

2:36 pm on Jun 25, 2017 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Jan 13, 2014
votes: 22

I found that one of my domains had disappeared on Bing

On further investigation I found another domain, I had never heard of was appearing instead with my content. It had replaced the original domain.

A quick whois lookup revealed just Privacy Protected, but the dns record showed the domain was pointing its A records to my ip

When I directly accessed the ip I found it displayed the same content as the original domain. (Not good)

So I added a small bit of php to the top of the domain to prevent direct access that I found online

$servername = $_SERVER['SERVER_NAME'];
if($servername == 'your-domain.com'){

}elseif($servername == 'your-domain-with-www.com'){

die("Direct ip access not allowed!");

Problem solved, but thought I'd share in case anyone else experiences this

There are a number of other options please see [serverfault.com...]
9:12 pm on June 25, 2017 (gmt 0)

Moderator from US 

WebmasterWorld Administrator keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
votes: 642

Good info 3zero, thanks for posting.

A Record hijacking... yet another, easily accomplished way of stealing your hard earned work. I've always wondered how some site owners who never bother to keep a diligent eye on their properties even survive in today's environment.

As a kid, my family never locked our front door, no need. Doubtful anyone does that today.