Take the 2-minute tour ×
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.

I have performed a dig on my domain name used on my site and I seem to be getting different results when I drop the "www." from the lookup. I am concerned this is causing me issues within my application, however i'm not sure if it's a red herring or not.

When I do this:

 dig @8.8.8.8 www.php53.staging-crm.com

I get:

;; ANSWER SECTION:
www.php53.staging-crm.com. 14400 IN A    165.160.xx.xx
www.php53.staging-crm.com. 14400 IN A    165.160.xx.xx

Similarly, when I drop the "www.":

 dig @8.8.8.8 php53.staging-crm.com

I get:

;; ANSWER SECTION:
php53.staging-crm.com. 14400 IN  A       80.75.xx.xx

(full IP addresses have been removed).

What would cause these to return different IP addresses?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

Whatever dig reports is the truth. You should conclude that www.php53.staging-crm.com maps to 165.160.x.x and php53.staging-crm.com maps to 80.75.x.x.

There is no particular reason why they should map to the same address. It is common these days to have the unadorned domain name map to the same address as www for the convenience of web users, but that is nothing more than a convention. Your domain's entries just aren't defined that way now.

share|improve this answer
    
Within my application I use the PHP function fpassthru, within my hosts file I map 127.0.0.1 to www.php53.staging-crm.com so I was concerned that as dig didn't report the same IP for both with and without the "www" then this could be an issue. –  crmpicco Apr 17 '12 at 16:35
    
dig is a DNS lookup utility, and does exactly that. It ignores /etc/hosts. It ignores /etc/nsswitch.conf. Therefore, your web browser might get different results when it performs hostname-to-address lookups. –  200_success Apr 17 '12 at 19:48

Actually the domain name www.php53.staging-crm.com is the child domain of php53.staging-crm.com. They may or may not map to the same address. In your case both are mapped to two different IP addresses.

share|improve this answer
    
Do you believe this should be a problem if I have more than one instance of Apache? –  crmpicco Apr 17 '12 at 16:46

Your Answer

 
discard

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.