Hacker News new | past | comments | ask | show | jobs | submit login
Your Site Only Works with WWW? How and Why to Fix It (emagineengine.com)
6 points by EmagineEngine on Dec 23, 2011 | hide | past | favorite | 9 comments



"Fix"...right. This is in fact a really bad idea and should be avoided.

The main argument for shortening domains seems to be based on what people will type. But every web browser I've seen will try "www.xyz.com" any time you type just "xyz". So leave the interpretation of lazy typing to the browser bar where it can be converted into a canonical form on behalf of the user.

There are plenty of reasons not to make the raw domain a web site. Here are a few:

- Potentially destroys popularity rankings in search engines because there are multiple addresses for every page. One popular site instead looks like two less-popular sites.

- So-called CNAME in DNS cannot use bare domains. IP addresses must therefore be hard-coded in a way that is more difficult to change quickly as needed (e.g. load-balancing, discovery of a DDoS attack, whatever). So users of the raw domain "xyz.com" will see your site go down for longer than it should have, even if you've already managed to bring "www.xyz.com" back up by changing its IP address.

- Configurations where patterns may be useful don't work, e.g. neither "{glob}.xyz.com" nor "www.{glob}" will match a bare domain. Maybe you don't care if you have just one site to worry about, but this gets old if you have a lot of domains to worry about.


Good info there. Should note that the article is agnostic about which is better (with or without www). It tells how to make it work with both versions of the domain, and then suggests redirecting to one of those domains to focus link juice.

Also note that in our experience, Google Chrome does not redirect automatically to www. And Chrome is very, very popular now.


Chrome doesn't do that exactly, it requires Control-Enter (which I admit many people wouldn't try). The autocomplete/search during typing does tend to product correct domain suggestions too.


> - Potentially destroys popularity rankings in search engines because there are multiple addresses for every page. One popular site instead looks like two less-popular sites.

Certainly you should never make both www and non-www work without redirecting one to the other. Personally, I redirect www to non-www for every domain I control. However, redirecting non-www to www at least makes both names work.


The existence of a redirect helps users find the site with either name, but there's no guarantee that anything else will see the correlation.

If two paths actually work, then invariably some web sites will choose to link to your page with http://xyz.com/foo/bar/baz.html and other sites will choose to link with http://www.xyz.com/foo/bar/baz.html. Each version of the URL has its own "referrer count" in a search engine, making the page seem less popular overall.

While search engines could do extra work to identify URLs that are aliases of one another, they're not obligated to do that. And even if a search engine does what you want, other tools may still be confused by duplicate paths (e.g. an archiving system or other link crawler).


Search engines and many other tools do take redirects into account to determine the canonical locations of pages and sites. Google documents their approach of canonicalization, and it would surprise me if other major search engines didn't follow suit.

Also, people tend to take the redirect as a hint about the canonical name of the site. If nothing else, people copying from the location bar or from other links will tend to end up with the version you redirect to. Only people who manually type URLs (and don't check them with the site to see where they end up) will use the non-canonical name. Between that and the search engine canonicalization mentioned above, I see little danger in redirecting one name to the other so both work.

And on the flip side, making both names work ensures that if anyone does visit or link to the wrong name, they still end up at your site. Intentionally giving a "server not found" error or similar seems like significantly worse behavior.


And that's the reason that the redirect in the article includes "301" -- to indicate to the search engine that it's a permanent redirect.


If you have to be told this, odds are, you should not be the one tinkering with DNS or web server config files.

The most frustrating pattern is when www.example.com works and example.com goes to their Outlook Web Access. It used to happen so much that I wonder if it was some misguided default configuration used by some hosting company.


Using mod_rewrite seems like massive overkill here. A simple RedirectMatch will handle it just fine.

Also, I agree strongly with this, and I redirect www to non-www on every domain I control. http://no-www.org/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: