Reputation: 662
Another domain is showing duplicate content of my website (all pages) When I entered this domain I see my site content.
If I change something on my site, I see it immediately on the another domain.
I think he's using some function fopen
or curl
or something else to show my content immediately from my website
How do I block it?
*my server: cpanel, php5
Upvotes: 9
Views: 2793
Reputation: 1198
You can use their IP address to serve them a 404 page. Or if you really want to be clever. For just their IP address serve wrong or embarrassing information that looks similar but is not the good content.
if($_SERVER['REMOTE_ADDR'] == "12.1.3.5"){ //banned IP
//do something else
}
Upvotes: 3
Reputation: 553
Try checking the user agent if it is not a browser Firefox , safari ...Deny accessing this will freak out the other domain that is copying your pages example:
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE){
//Internet Explorer Good
}else{
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE){
//FireFox Good
}else{
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE){
//Chrome Good
}else{
//Check for safari , Opera , AndroidBrowser and IOS browser , Internet Explorer Mobile and text phones
//else run this code
die("Acessing this site is only allowed from this domain example.com");
}
}
}
EDIT:
append this code to your .htaccess
BrowserMatchNoCase SpammerRobot bad_bot
BrowserMatchNoCase SecurityHoleRobot bad_bot
Order Deny,Allow
Deny from env=bad_bot
As people have said in comment the user agent is empty:
if(empty($_SERVER['HTTP_USER_AGENT'])){
die("Error");
}
You could also apply the ip address so it will be harder for the other domain to break you:
You can also check for the UserOperating system but it is not required as it will may cause problem for some users so just don't do it but it still a good idea.
keep me UpToDate for any help
Upvotes: 0