Solved

Non-Defined Subdomains

Posted on 2011-03-05
3
253 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:cstormer
3 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35044633
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

0
 

Author Comment

by:cstormer
ID: 35060167
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..
0
 
LVL 9

Accepted Solution

by:
jeremycrussell earned 500 total points
ID: 35060699
Ok, so, unless you have some type of DNS record to cover all the possible <text>.domain.com the, when they are entered, they won't resolve.

To accomplish what you mentioned, you could do this by having A or CNAME records for your "valid" FQDNs, and then use a wildcard A record, assuming your DNS provider supports that.

Then, you could use some rewrite rules send "invalid" FQDNs to a particular page.

For instance, with Apache and mod_rewrite.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain.com$
RewriteCond %{HTTP_HOST} !^www.domain.com$  (you would have a rewrite condition for all your "valid" subdomains.
RewriteRule ^(.*) http://domain.com/$1

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Replication dns zone issue 2 48
Redirect to catagorie in case of 404 4 32
Rewrite Rule head scratcher 18 27
htaccess - disable PHP in specific directory 1 17
One of the most often confused topics in the area DNS is the idea of GLUE records. Specifically, what they are, when they are needed, when they are provided, and how they are created. First, WHAT IS GLUE? To understand GLUE, you must first under…
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question