Solved

Non-Defined Subdomains

Posted on 2011-03-05
3
216 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

This article is intended as an extension of a blog on Aging and Scavenging by the MS Enterprise Networking Team. In brief, Scavenging is used as follows: Each record in a zone which has been dynamically registered with an MS DNS Server will have…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now