How to block another domain to access and get result from my website?
Asked Answered
C

2

9

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

Crim answered 20/9, 2013 at 12:8 Comment(8)
check logs and block request from that domain/ip?Gobo
Other website might be using a proxy.Eggcup
looking referer is an option but can be spoofed, and i think cannot be done at allDutton
Post the d-bags website on 4chan and see if you can get them to do a ddos...Maggot
Check the access log. Do you see a particular script that access your site daily or in an interval? Does you site publish a RSS or ATOM feed? Can you share the information here?Marcheshvan
It could be interesting to know who is the douchebag site alsoHuzzah
@MonkeyZeus: Check this question: serverfault.com/questions/388515/htaccess-blocking-proxyEggcup
Get a lawyer, sue him.Hoitytoity
F
3

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

}
File answered 20/9, 2013 at 12:11 Comment(3)
What I do when he change the ip ?Crim
You rewrite the script for the new IP?Huzzah
You can write a cron job to regularly check the ip for the website and store it in a database of sorts and just do whatever you want with those specific IP's. I say troll them all to be honest.File
R
0

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

Ruffianism answered 20/9, 2013 at 12:27 Comment(2)
Why don t you use else if instead of else{if} ?Huzzah
user agent is empty from this domainCrim

© 2022 - 2024 — McMap. All rights reserved.