Link to home
Start Free TrialLog in
Avatar of Chris Stormer
Chris Stormer

asked on

Non-Defined Subdomains

How can I force my website to not function when there is a subdomain that is not in the dns.

ex//

test.domain.com <- invalice
mail.domain.com <-valid

how can I force test.domain to go to domain.com is this a dns issue or a server setting?
Avatar of farzanj
farzanj
Flag of Canada image

Try iptables

If the entry is not in the DNS, it should not get a reply.

Block Invalid
iptables -A -p tcp -d test.domain.com --dport 80 -j DROP

Open in new window


Forwarding to another domain
iptables -t nat -A PREROUTING -d test.domain -p tcp --dport 80 -j DNAT --to domain.com

Open in new window

Avatar of Chris Stormer
Chris Stormer

ASKER

A follow up question is which is better from an SEO point of view?

Is it better to make all the sites with broken links that point to my domain still function if someone clicks on the link or Google comes in off that link... by having them redirect to the domain.com version.

Basically..

badtext.domain.com/page/page.php = .domain.com/page/page.php

Is that more of a URL rewrite... issue or should i just make anything that does not point to the right domain not work..
ASKER CERTIFIED SOLUTION
Avatar of jeremycrussell
jeremycrussell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial