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

**URL:** <https://www.ruby-forum.com/t/redirecting-both-http-xxx-and-http-www-to-one-uniform-ur/148006>\
**Category:** Rails\
**Created:** [September 8, 2008, 8:34am UTC](https://www.ruby-forum.com/t/redirecting-both-http-xxx-and-http-www-to-one-uniform-ur/148006 "2008-09-08T08:34:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [September 8, 2008, 8:34am UTC](https://www.ruby-forum.com/t/redirecting-both-http-xxx-and-http-www-to-one-uniform-ur/148006/1 "2008-09-08T08:34:14Z")

</div>

Hi,

I observed that [http://xyz.com](http://xyz.com) and [http://www.xyz.com](http://www.xyz.com) don’t use the same  
session ID. If i log in using URL [http://xyz.com](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](http://xyz.com) and [http://www.xyz.com](http://www.xyz.com)),  
i would always redirect them to [http://www.xyz.com](http://www.xyz.com).

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

Regards,  
SG
