I came across an issue where I saw a domain xyz.com that is pointing to mydomain.com.

How do I prevent spam domains from pointing to my domain? I read some posts about setting my virtual hosts and such, but nothing specific about how to prevent it in the first place.

I searched on Google, but most answers are for Apache or IIS, and I'm using Tomcat 7 to serve content directly.

  • It is likely a server at your web host. Provide the domain that is redirecting. You can back trace it to the source, likeihood its a matter of contacting your web host. Apr 2, 2013 at 11:50

2 Answers 2


If the offending domain is showing a copy of your site, then you certainly want to avoid letting it continue lest you end up getting penalised for duplicate content. This post on Stack Overflow appears to have a helpful answer for your case, since you know the domain that's the problem:

There isn't a way to set this up as easily as you're able to with Apache. The closest thing would be to make a servlet or jsp to handle the redirect and then map it to the URL you want to redirect from.

As @bybe mentioned, contact your hosting company and ask if they can do anything to help. It would also be worth tracing the domain back to its registrar and contacting their technical support to see if they'd be willing to get involved.


Anyone can point their DNS at your IP address. If you don't have control over that domain then there is nothing you can do, but nothing you need to do. Just ignore it and/or do a 301 redirect to your preferred domain for requests with a different domain in the header.

In a shared hosting environment multiple sites can run on the same address, it is quite normal for multiple unrelated domains to point to the same IP address although these requests should not hit your actual site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.