Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

My server is returning the correct paths for all of my domains as long as they are not prefixed with www. The following is one of my domains in it's simplest form:

<VirtualHost *:80>
  DocumentRoot /home/kyle/www/

I can provide logs if needed. The server is running Ubuntu:

  Distributor ID:   Ubuntu
  Description:   Ubuntu 12.10
  Release: 12.10
  Codename:   quantal
share|improve this question
Does a DNS lookup on both the www-prefixed name and the non-prefixed name return the same IP? – John Feb 22 '13 at 14:29

1 Answer 1

up vote 2 down vote accepted

The DNS A record for is absent, so you need to fix the DNS to allow it to work as you expect:

$ dig any

; <<>> DiG 9.9.2-P1-RedHat-9.9.2-3.P1.fc17 <<>> any
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49816
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 3, ADDITIONAL: 4

; EDNS: version: 0, flags:; udp: 4096
;           IN  ANY

;; ANSWER SECTION:        7200    IN  SOA 1360369139 3600 900 1209600 10800        7034    IN  A        7200    IN  NS        7200    IN  NS        7200    IN  NS

;; AUTHORITY SECTION:        7200    IN  NS        7200    IN  NS        7200    IN  NS

;; ADDITIONAL SECTION:   7028    IN  A   7028    IN  A   7028    IN  A
share|improve this answer
Isn't the ServerAlias supposed to handle that? – ott-- Feb 22 '13 at 15:28
The ServerAlias lets Apache respond to different names. It doesn't create DNS records. Having the correct DNS record is a prerequisite. – John Feb 22 '13 at 15:31
@ott-- How would it handle a non-existent hostname? Contact the authoritative DNS server and register the name? The provided host name has to be resolvable to be useful. At best, the server could ignore the error and use the alias anyway, but far more common than the web server and outside clients having different ideas of the DNS namespace would simply be a mistype, which this error/warning does alert the administrator to. – Michael Kjörling Feb 22 '13 at 15:33
Thanks for the reply. I thought that @ would point both the domain and www-domain to the same IP? Anyways, I added an A record (not sure if it's done right): – slowBear Feb 22 '13 at 15:38
@slowBear CNAME or A is not important - both will let the thing to work properly (provided CNAME points to the resolvable name). You may add A record or CNAME - it is up to you. There is no standard that enforces you to use CNAME in this case. CNAME simplifies management tasks, but it is not a must. Also, CNAME leads to a subsequent query on the name it points to. – Serge Feb 24 '13 at 12:31

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.