Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Does anyone know the solution to this problem?

I checked my zone file and there are 2 A records

mydomainname.com.   14400   IN      A       ip.address.x.x

localhost       14400   IN      A       127.0.0.1

CNAME entries currently in my zone file

mail    14400   IN      CNAME   mydomainname.com.
www     14400   IN      CNAME   mydomainname.com.
ftp     14400   IN      CNAME   mydomainname.com.

I'm On CentOs 5.2, by the way.

Thanks for the help!!

share|improve this question
    
@kbyrd: I don't understand your nit. How is that different from what he wrote? Are you confused about the trailing period? It's supposed to be there, however some DNS servers will automatically add it for you if you forget it. But it's good to put it there just in case. –  davr Mar 29 '10 at 17:19
    
@jeff: Please tell us the actual problem. "doesn't work" doesn't tell us enough information. Does the hostname resolve to an IP address? Does it connect to the server? etc etc. –  davr Mar 29 '10 at 17:20
    
@davr: domain doesn't resolve without the www. –  jeff Mar 29 '10 at 23:22

3 Answers 3

This is most likely a web server configuration problem. You can confirm or deny this by ping/dig/nslookup the domain name both with and without the 'www.'. If pinging (for example) each hostname resolves to the same IP address, your DNS is working properly.

For Apache, the configuration in /etc/httpd/conf/httpd.conf should look something like:

<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    ServerAdmin webmaster@yourdomain.com
    DocumentRoot /home/sites/yourdomain.com/web
    ErrorLog /home/sites/yourdomain.com/logs/error_log
    TransferLog /home/sites/yourdomain.com/logs/access_log
</VirtualHost>

Optionally, if you want to use mod_rewrite to enforce the 'www' component, add the following before the ending </VirtualHost> tag:

RewriteEngine on
RewriteCond %{HTTP_HOST}            !^www.yourdomain.com(:80)?$
RewriteRule ^/(.*)                  http://www.yourdomain.com/$1 [L,R]
RewriteOptions inherit
share|improve this answer
    
Thanks for you help! I'm afraid, though, that my httpd.conf file looks just like your example for ServerName and ServerAlias so perhaps that not it. To confirm, pinging without www doesn't resolve. Would restarting something other than apache help? Thanks again for your time! –  jeff Mar 29 '10 at 23:17

Either add an A record for www to point to your ip address, or add a CNAME for www to point to the root (each has it's own set of positives/negatives for large organizations, but either would make your www go).

share|improve this answer
    
Sorry, but i'm a novice at server configuation. How would this look like? Something like this?: www.mydomain.com 14400 IN A ip ? Also, is the amount of spacing significant? –  jeff Mar 29 '10 at 16:42
    
I added my current CNAME entries in my original post for clarity. Thanks for the help! –  jeff Mar 29 '10 at 16:47

Check your webserver configuration and ensure it is accepting connections to both domain.com and www.domain.com. In Apache this would be the ServerAlias line.

share|improve this answer

Your Answer

 
discard

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