Solved

Non-Defined Subdomains

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

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 …
Resolve DNS query failed errors for Exchange
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 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

23 Experts available now in Live!

Get 1:1 Help Now