Hi everyone, I want to go live with my application. But something is wrong with my site when using www.domain.com or domain.com. It seems that it use different instances of the app and create different sessions. How can I configure my app to redirect to www.domain.com when someone calls domain.com? Thanks in advance Adam -- Posted via http://www.ruby-forum.com/.
Personally, I redirect www.example.com to example.com (example.com is already a web site, no need for redundancy and it makes hard then for people to assimilate blog.example.com (so, a blog is not a web site then?) or newyork.example.com (where''s www?) but I digress). I redirect at the Apache level doing: <VirtualHost *:80> ServerName www.example.com ServerAlias example.org www.example.org Redirect / http://example.com/ </VirtualHost> The trailing slash in "Redirect / http://example.com/" is important ;) On Sun, Nov 8, 2009 at 23:19, Adam Meyer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > Hi everyone, > > I want to go live with my application. But something is wrong with my > site when using www.domain.com or domain.com. It seems that it use > different instances of the app and create different sessions. > > How can I configure my app to redirect to www.domain.com when someone > calls domain.com? > > Thanks in advance > > Adam > -- > Posted via http://www.ruby-forum.com/. > > > >-- J. Pablo Fernández <pupeno-GAtDADarczzQT0dZR+AlfA@public.gmane.org> (http://pupeno.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Meyer wrote:> Hi everyone, > > I want to go live with my application. But something is wrong with my > site when using www.domain.com or domain.com. It seems that it use > different instances of the app and create different sessions. > > How can I configure my app to redirect to www.domain.com when someone > calls domain.com? > > Thanks in advance > > AdamHi, In .htaccess you specify the rewrite url rule to redirect domain.com to www.domain.com Place below code in .htaccess RewriteEngine On RewriteCond %{HTTP_HOST} !^www RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R=301] Thanks, Priyanka Pathak -- Posted via http://www.ruby-forum.com/.
Priyanka Pathak wrote:> Adam Meyer wrote: >> Hi everyone, >> >> I want to go live with my application. But something is wrong with my >> site when using www.domain.com or domain.com. It seems that it use >> different instances of the app and create different sessions. >> >> How can I configure my app to redirect to www.domain.com when someone >> calls domain.com? >> >> Thanks in advance >> >> Adam > > Hi, > In .htaccess you specify the rewrite url rule to redirect > domain.com to www.domain.com > Place below code in .htaccess > > RewriteEngine On > RewriteCond %{HTTP_HOST} !^www > RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R=301] > > Thanks, > Priyanka PathakThanks, I realized it with a .htaccess. The vhost configuration sent me in a loop. Cheers -- Posted via http://www.ruby-forum.com/.