Solved

Non-Defined Subdomains

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is harden windows 10 for security? 5 118
Clearing router cache 12 45
What is doing the required checks on the SPF and DMARC records? 11 28
DNS Domain Issues 10 25
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Occasionally you run into the website or two that will not resolve properly using your own DNS servers.  Some people simply set up global forwarders for their DNS server.  I don’t recommend doing this because it can cause problems resolving addresse…
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 …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 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