Solved

Non-Defined Subdomains

Posted on 2011-03-05
3
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: 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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

736 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