After setting this site up on WordPress (way easier than I expected), one of the first things I noticed when navigating to “http://goajax.net” was that “www” was getting attached to the front of the URL, resulting in “http://www.goajax.net” in my browser’s address bar. This came as a surprise because I specifically configured the site to accept both www and non-www forms without redirecting to either. I configured this setting via DreamHost’s Domain Management Panel (DreamHost is the company that hosts this site). As I have other sites configured the same way and working as such, it was a bit of a mystery why this site was misbehaving.
I mentioned this to a buddy at work and he quickly pointed me to Matt Cutt’s blog entry on URL canonicalization. A very interesting read. Apparently, using both www and non-www forms of a site’s URL isn’t recommended in terms of SEO. When building links to various pages of a site, it’s best to stay consistent so that search engines don’t have to try to decide between multiple similar URLs. My initial decision to drop the ‘www’ was mostly for aesthetics and brevity, but after reading the article it made even more sense to do it.
Back to my issue. Why was this site redirecting? Viewing Firebug’s Net tab while loading the page revealed the answer. The request was returning a 301 status code and signalling the browser to redirect to the “www” address of the site. To add insult to injury, Firebug’s waterfall chart showed 600-800ms of added page load time due to this redirect. As a web performance junkie, this was completely unacceptable.
Evidence of my admitted WordPress-newbiness, the solution was simply in WordPress’s General Settings Page. All I had to do was change the WordPress and Site Address URLs to their non-www versions and my redirect woes were soon gone.