Stop another domain from displaying my website

Keith1976

Registered
Aug 8, 2021
4
1
3
England
cPanel Access Level
Root Administrator
Hi,

I've found out that another website is somehow displaying my website on their domain. So if I type in their url/domain into a browser my content is loaded at their domain. I assume they have set my servers ip address in a dns record.

I have contacted cloudflare which they are using and their host to try to get it taken down. But would appreciate any advice on what I can do from my side to stop it happening in the meantime.

Edit to say - using the below code at the top of .htaccess works:

RewriteCond %{HTTP_HOST} ^(www\.)?badwebsite\.com$
RewriteRule ^/?(.*) http://www.bbc.co.uk/$1 [QSA,R=301,L]

Thanks, Keith
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,494
1,009
313
cPanel Access Level
Root Administrator
Hey there! If the .htaccess code you posted does indeed resolve the issue, that would indicate they have indeed pointed the DNS to your system. There isn't a way to can solve that, except by performing the work you have done already.

I would recommend changing that to redirect to a 404 page or some other error message to help deter that traffic.
 

Keith1976

Registered
Aug 8, 2021
4
1
3
England
cPanel Access Level
Root Administrator
Thanks for the reply cPRex.

I like the 404 idea. Where example below is my domain, after setting up a custom error page in cPanel would this work:

RewriteCond %{HTTP_HOST} ^(www\.)?badwebsite\.com$
RewriteRule ^/?(.*) http://www.example.co.uk/404.shtml$1 [QSD,R=301,L]

Edit: I tested and it seems to work very well, thanks for the idea.
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,494
1,009
313
cPanel Access Level
Root Administrator
Yes, but you'd need some more advanced rewrite rules.

While I don't claim to be a .htaccess wizard, how about this:

Code:
RewriteEngine on
RewriteCond %{http_host} ^www.badwebsite.com [NC,OR]
RewriteCond %{http_host} ^badwebsite.com [NC]
RewriteRule ^(.*)$ http://www.example.co.uk./ [R=301,NC,L]
 
  • Like
Reactions: Keith1976

Keith1976

Registered
Aug 8, 2021
4
1
3
England
cPanel Access Level
Root Administrator
Thanks. I modified it slightly to give a 403 forbidden response. Everything is now working as intended.

Code:
RewriteEngine on
RewriteCond %{http_host} ^www.badwebsite.com [NC,OR]
RewriteCond %{http_host} ^badwebsite.com [NC]
RewriteRule ^(.*)$ https://www.example.co.uk [R=403,NC,L]
 
Last edited:
  • Like
Reactions: cPRex