When people access my app on http://www.example.com and log in, they get a cookie. I’m using the cookie option to store session on Rails. Accessing example.com (without the www), they must log in again, because Firefox does not recognize the previous session.
So, what do you think is the best way to avoid this?
I guess I will use a small .htaccess rule (Apache + Passenger) like this:
RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
Do you guys think that is a good solution?
What I would do is:
You don’t need to involve rails in this solution at all.