We have a website, example.com, on Digital Ocean. It seems there is a user that used to have our IP address that has enabled domain masking for their site, or they are just poingint their domain, domain.com, to our sute. We do not want domain.com displaying our website, so I would like to block domain.com.
I tried using this guide: https://perishablepress.com/eight-ways-to-blacklist-with-apaches-mod_rewrite/ , but it seems like this doens't work with domain masking.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)?domain(-|.).*$ [NC]
RewriteRule ^(.*)$ - [F,L]
</IfModule>
I saw this example: https://serverfault.com/questions/796674/block-masking-url-from-nginx/ , but I don't know how to translate this to Apache.