Redirecting both http://xxx and http://www to one uniform UR

Hi,

I observed that http://xyz.com and http://www.xyz.com don’t use the same
session ID. If i log in using URL http://xyz.com and then on adjacent
tab if i type in URL with www appended, then it creates one more new
session.

Now, I think redirecting all URLs to one uniform base URL is a solution.
Irrelevant to what users enter (http://xyz.com and http://www.xyz.com),
i would always redirect them to http://www.xyz.com.

How can i do this? In apache itself or can i do this in rails mongrel as
well?

Regards,
SG