Misfiring Neurons Just another geek with a blog

14Nov/10Off

Why some sites require the www prefix while others work just fine without it

Ever wondered why some web sites work if you type their name without the www. prefix, while others give you odd error messages and sometimes even result in the wrong page displaying? This is why.

It all starts with DNS, the Domain Name System. When you type a name in the address bar of a web browser it takes the server name and posts a query to your nearest DNS server. So for instance the URL http://example.com/somepage will result in a DNS query for example.com.

At this point, depending on how the domain was registered, the DNS will either respond with an IP address for example.com, or with a "not found" DNS reply. If there is no IP address record for the name you the browser will display a standard error page telling you that it cannot find such a site.

If the DNS responds back with an IP address, then the browser will attempt to connect and send an HTTP request to it. Here is where things tend to go wrong. HTTP supports a feature called virtual hosting where multiple web sites can be served by the same web server, using just one IP address. In order to distinguish between different sites living on the same server the browser sends an HTTP header indicating which site it wants to talk to. If the web server is not configured to correctly match up your request to a specific website hosted on it, it might return a default page (ISPs and large hosting providers tend to do that) or just serve the wrong website altogether.

If you are a webmaster and for whatever reason you wish to only have your website available when accessed using a www. prefix, you should ensure that your domain name does not have an A record. Most registrars will insert one by default when you first register a domain and so you need to remove it; only add an A record pointing to your web server against the www entry. That's it, now no one will be able to access your site without typing out the full name.

Most people will probably prefer to help their visitors out by allowing access via a shortened name as well. In order for this to work, you need to:

Make sure there is a correct A record against the base domain name

In DNS terms, this is called the @ record - the root of the specific DNS zone. So if your web server has an IP address of 192.168.0.1 the DNS zone should contain the following records:

@	A	192.168.0.1
www	A	192.168.0.1 

Make sure your virtual hosts are correctly defined

If you are using the popular Apache httpd web server you can use the ServerAlias directive to specify any number of alternative names to your site:

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com w3.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/example.com
</VirtualHost>

Bonus: make sure your web server is set up to serve a default error page if it doesn't recognize the virtual host requested

What happens if someone mistakenly point a DNS name to your web server? In Apache, the first virtual host is the default one and if no server name or alias matches the request, that is what will get served. So if you are hosting multiple virtual hosts on your server, make sure the first virtual host you define points to a page containing some meaningful message stating that the site is not yet up.

Optional: rewrite the URLs to redirect visitors to your preferred domain name

If you would prefer your visitors to use one specific name for your site - e.g. for marketing reasons - you can use the following configuration to redirect those using the alternative name:

<VirtualHost *:80>
    ServerName www.example.com
    Redirect permanent / http://example.com/
</VirtualHost>
<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/example.com
</VirtualHost>

In this case you should remove www.example.com from the aliases.

Bottom line: make sure that whatever DNS records you do have are also configured in your web server. And unless you have a good reason not to, you should probably add the short domain name as a valid alternative.

Filed under: Rants, Web No Comments
11Feb/10Off

Stop Buzzing me!

Google has rolled out Buzz to much discussion - reactions vary from "can't be bothered, turned it off" to "this is the new Twitbook killer". Here are some very unstructured thoughts on the subject.

Let me start with an observation on the two biggest players in this space. Twitter and Facebook are diametrically opposite in the way that their social links work - Twitter is asymmetrical where following someone has no implication for them. Befriending someone on Facebook on the other hand is a symmetrical relationship. (Facebook has tried to augment this, quite successfully, with the Pages feature.) These core properties also dictate the experience: Twitter serves up small slices of chatter and subscribers see updates fairly close in time to them being published. Facebook on the other hand personalizes your news feed and prioritizes items based on your past activity. (You can also choose to view the latest news from all your Facebook friends from a couple of iterations ago - see a pattern here?)

Buzz's major downside for me at the moment is that the popular posts tend to stay at the top, even if I'm not that interested in them. If you contrast to the above paragraph, you'll see how it fits right in the middle - you get a public conversation with the "buzzing" items floating up to the top. Google will probably tweak the post prioritization over time to get the signal-to-noise ratio lower (I would like a button to mute specific items for starters. Edit: ah, it's right there in the little triangle menu - silly me).

Jason Calacanis writes that "Facebook just lost half its value". I'm not convinced of that - for one, Facebook has iterated on their UI much more and is very good at catering to the use cases that people want from it, IMHO. Another is privacy concerns - for all the gaffes, Facebook does actually have working privacy controls. Google has a lot of catching up to do in pure features here. That is, if they even want to go there. My guess is that they'll stay out in the open like Twitter and sidestep the issue. Simple example: I would upload photos to Facebook that will never see Flickr or Google's Picasa data centres.

I also think that it's Twitter that may have lost half its value - in the 24h that I've had Buzz in my Gmail, I've seen much more potential to strike up a conversation in public on Buzz than I have on Twitter, which in turn tends to be quite impersonal until you have built something of a following. If Google provides an API with open access, Buzz could really become the centre of one's online universe. One potential killer feature (for technogeeks anyway) would be to aggregate ad-hoc social interactions such as comments on blog posts and forum posts from all over the internet. Blogger is already supported, all that's needed is push support in Disqus and vBulletin/phpBB . The challenge here will probably be minimizing noise - think Facebook app spam.

Related - Buzz from the corporate network. How many companies block access to the likes of Facebook? I'd guess quite a few, especially once you reach a certain size. Gmail on the other hand is often permanently open in a browser right next to the corporate Exchange mailbox. Short term advantage to Buzz here, but how long before the network policy declares it an enemy? Gmail is already on the borderline as it is with the embedded Google Talk feature.

I have turned Buzz off for the time being but I will keep revisiting it. I would have much preferred a standalone page which I can visit. As it stands, I find it very distracting in my Gmail. At the same time, I think that over time it will become a very useful tool. I suspect it will eat more into my Twitter usage than Facebook. And I should imagine that Buzz will really hit its stride once mobile support is rolled out.

Filed under: Web No Comments
8Jul/09Off

Google Chrome OS

I had to do a double check if it's not April 1st. Why Chrome OS? And why not Android?

Firstly, this does not sound like another Linux distro. Yes, it might run on top of a Linux kernel and borrow some UI code, but you can think of this as a web browser that runs on the bare metal. What use is such a thing? (ASUS is already doing something similar by embedding a stripped down Linux in their motherboards. It boots in a couple of seconds and lets you browse the web and check your email.)

Google makes money off people using the Internet. More than that, they especially benefit from stuff that runs on open platforms - HTML and JavaScript as opposed to Flash and Silverlight. Hence the massive investment in technologies such as GWT and Gears that enable full-blown interactive applications inside a browser using widely understood open standards. The more people publishing useful stuff on the web, the more Google stands to benefit. The more users on the web, the more Google stands to benefit.

The Chrome OS could work quite well on a stripped down netbook (even lower spec than what we call a netbook today), touch-screen tablets, or minimalist desktop computers with specs along the lines of netbooks.

Given the recent popularity of netbooks, and Microsoft starting to push Windows 7 to OEMs instead of the ancient XP, maybe Google is hoping that some of them will jump ship and give Linux a second chance. What's going to be different this time? If you don't pretend it's a full-blown computer but rather a web-only "device", it's easier to sell it to people who already have several computers in their household.

The ultra low hardware requirements mean that the machine itself should be cheaper to produce too, so once again adding to the "it's a web appliance, not a computer" selling point. Lastly, this must have been fairly easy to do from a technical standpoint. It's simply repackaging a bunch of existing code into something usable so not a hugely risky project for Google.

If some Taiwanese manufacturer jumps on board and produces anything even remotely successful based on this software, it only further entrenches the Web as an application platform. And that, I think, is exactly what Google is hoping for. It's very much the same thinking as that behind Android, just aimed at a different segment of the hardware market.

UPDATE: Further reading - coverage from around the web:

Filed under: Geeky, Web 2 Comments
7Jan/07Off

Simple Machines Forum

I've been running a small HiFi/HT forum for about a year and a half - AVForums - and recently got rather fed up with phpBB's bugs. Just before I spent the bucks on vBulleting, I discovered SMF and thought I'd give it a try. What a nice surprise - clean and logical management interface, easy to install "packages", and a much more modern UI (very similar to vB in fact). Also it appears to be a lot more secure than phpBB - something you really should worry about given the rise in comment spam lately.
In the process of converting my phpBB database (probably due to the fact that I was using phpBBFM and not a vanilla phpBB installation), I encountered some strange errors for which I could find no answer readily. Those included some topic notifications and group permissions which failed to migrate over to the new format. If you have these issues, do not ignore them and just carry on (even though the bulk of the data might seem to have copied). Rather skip that particular section only by editing the phpbb2_to_smf.sql and deleting only the sections that I did not want to import. I went over all the settings (moderators/permissions in particular) in the SMF Admin console afterwards - a lot of the migrated settings are actually redundant and could be deleted. So far I am very impressed and can highly recommend this package to anyone who is running a phpBB instance or thinking of starting their own bulletin board and can't justify vBulletin.

Welcome to the upgraded AVForums

Filed under: Audio-Video, Web Comments Off