Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a domain for my site:

I am also running local DNS with these lines:

www IN CNAME server.<host_provider>.com.
dev IN CNAME server.<host_provider>.com.

So and go to production and development sites, respectively, that are hosted by a host company.

In my Apache configuration for the main site, I'm running a rewrite rule like this:

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^example\.com$|!dev\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=302,L,NE]

This rule seems to work, as when you are off the network and go to in the browser, you get redirected to

The problem is when I'm on the network, and I go to I get an error page, saying page can't be found. No server errors; just a page can't be found, as if the local DNS is causing it to stop looking at that point.

I'm also using Nettica for DNS service and have this A record in place: Host (A) Default

This handles the external DNS, but my problem seems to be related to my internal DNS.

For example, inside my network, I can go to servers on the network with addresses like this:

These are configured in my local DNS. I'm just not sure how to get past the "empty" subdomain and go to

Adding to this since it might not be clear. If I'm out side the network, on another network, like, then when I go to I'm redirected to as expected, eg, the Apache rewrite rule is working.


With the help of @ErikE and troubleshootinig and testing, I found an answer. Seems I discovered another way along with @ErikE's suggestion:

In local DNS adding either one of these seems to work: IN CNAME server.<host_provider>.com. IN CNAME


share|improve this question
I wish I could actually get information about why there is a down-vote. Is this really that bad of a question? – nicorellius Nov 5 '13 at 20:58
don't worry about votes buddy... they worth less than reddit votes – Howard Nov 5 '13 at 21:10
I know, dude, but the whole point is constructive criticism and advice. Faceless down-votes are just lame... Especially when it's a genuine question that has a good amount of details. – nicorellius Nov 5 '13 at 21:22
Well, if you are in the network does the record resolve to what you expect it? Is there a DNS setup at that site which has this zone also configured (Active Directory maybe)? – faker Nov 5 '13 at 21:28
When you're inside the network and you use dig or nslookup, whats the returned result when you query for Is it what you expected? And if the Server is in the same network as you, is it possible this is a firewall issue where you're trying to go out the network and then right back in? – Safado Nov 5 '13 at 21:43
up vote 1 down vote accepted

It sounds to me like you need an empty A record (or other record to the same effect) for the domain itself in your local dns.

If I remember correctly (some time has passed since I last did this), in BIND this can be achieved using the following syntax in the zone file of


or in Windows DNS:

@    IN A

However, using dnsmasq for instance this would be configured in a completely different way. So, what brand of dns server are you using locally?

I am uncertain if one can write CNAME records in the same way. You could certainly try if you wish to refer to your provider instead of writing the ip addresses explicitly in your local dns.

share|improve this answer
Nice answer... It made me think of another solution. See my OP. Awesome ;-) – nicorellius Nov 5 '13 at 22:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.