How can I stop access using a domain name using htaccess?

I have multiple domain names pointing to a single directory. There is another domain that is also pointing to the accounts ip address. I want to stop the server from serving anything to the "other" domain.

All resolve to /home/person/public_html using one ip address
is resolving to this same ip address and the pages from are being served.

I don't have any control over, just my own apache server.

I want to use htaccess to stop all requests for from serving's pages. Preferably returning a 404 or other more relevant code for "does not exist".
Who is Participating?
Steve BinkCommented:
You can also use mod_rewrite to return a forbidden response:

RewriteEngine on
RewriteCond %{HOST}  ^
RewriteRule  .* - [F]
Well the easy way is not to use .htaccess.  Instead setup a name based virtualhost, create a document root for that named based virutal host and return a web page that says, this is no longer valid, please stop using.

Now, if you really want to use .htaccess then you would use rewrite and change the URL to one that does not exist.

Something like:

RewriteEngine on
RewriteCond %{HOST}  ^

As a side note, you can lookup who owns that domain named and contact all/any of the contacts for that domain name inform them they the host name "" is pointing to an IP address that is allocated to you and you would appreciate it very much if they would change it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.