Skip to main content

Stop another domain from displaying my website

Comments

6 comments

  • cPRex Jurassic Moderator
    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.
    0
  • Keith1976
    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 ^/?(.*)
    0
  • cPRex Jurassic Moderator
    You're welcome!
    0
  • Keith1976
    Just one problem with the above solution. RewriteCond %{HTTP_HOST} ^(www\.)?badwebsite\.com$ RewriteRule ^/?(.*)
    0
  • cPRex Jurassic Moderator
    Yes, but you'd need some more advanced rewrite rules. While I don't claim to be a .htaccess wizard, how about this: 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]
    0
  • Keith1976
    Thanks. I modified it slightly to give a 403 forbidden response. Everything is now working as intended. 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]
    0

Please sign in to leave a comment.