10.8: Open a specific browser based on the URL

Usually I want to open Gmail in Chrome and URLs pointing to my development server in Firefox. For everything else I use Safari.

There is this nifty free app called LinCastor that enables you to register your own handler for an URL. Although it had beed designed to register your own non-standard URL schemes, it can intercept standard http and https as well.

In LinCastor (which you need to double-click twice to fully open for editing):
Add a new URL scheme
Choose AppleScript handler

Paste the following code in, (replacing the stub code at the bottom):

on handle_url(args)
if (|URL| of args starts with “https://mail.google.”) then
tell application “Google Chrome”
open location |URL| of args

Source: Mac OSX Hints