views:

693

answers:

1

I have an .htaccess file that is redirecting everyone to the www. version of a site. Like so:

      RewriteCond %{HTTP_HOST} ^baldwinbrothersinc\.com$ [NC]
      RewriteRule ^(.*)$ http://www.baldwinbrothersinc.com/$1 [L,R=301]

When I go to baldwinbrothersinc.com in Firefox or Safari, I am redirected to www.baldwinbrothersinc.com . Sweet.

When I do the same thing in Opera, IE7, or Chrome, I am redirected to a Page Not Found message (or a "DNS not found" message, depending on the browser). I don't get it. These are server settings, not things that are interpreted by browsers, right?

I know that the hosting for this site is a little funky (they are not pointing the whole domain to my nameservers, but instead are using an A-record to redirect web traffic) but I have no idea how to fix this.

+5  A: 

That's because some browsers fix up the URL and add www.. The problem is not the htaccess, but the lack of a DNS entry for baldwinbrothersinc.com:

$ dig baldwinbrothersinc.com
;; (...)
;; QUESTION SECTION:
;baldwinbrothersinc.com.                IN      A
;; AUTHORITY SECTION:
baldwinbrothersinc.com. 785     IN      SOA     NS83.WORLDNIC.com. namehost.WORLDNIC.com. 109030615 10800 3600 604800 3600
;; (...)

$ dig www.baldwinbrothersinc.com
;; (...)
;; QUESTION SECTION:
;www.baldwinbrothersinc.com.    IN      A
;; ANSWER SECTION:
www.baldwinbrothersinc.com. 7195 IN     A       205.153.119.13
;;(...)

You have to configure your nameserver first to resolve baldwinbrothersinc.com to 205.153.119.13, too.

phihag
What is this "dig"?!? I had no idea I could look up DNS info right from my terminal. So I'm guessing this needs to be attended to by the person who controls the domain name (AKA not me). Thanks!!
Eileen
Dig is a linux command.
epochwolf
in addition to "dig", you may find the "whois" and "host" commands interesting...
rmeador
dig is certainly not "a linux command". It runs on every Unix, from Solaris to MacOS!
bortzmeyer