So i have a rails app running in 2.0.2 and I would like to know if anyone can point me in the right direction on how to remove the www from the url. so if someone goes to www.mydomain.com it will forward them to mydomain.com. I am running nginx, and thin, not sure if I do it in routes, in my nginx config file...? let me know if anyone has any insight to this. thanks. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Paul wrote:> So i have a rails app running in 2.0.2 and I would like to know if > anyone can point me in the right direction on how to remove the www > from the url. so if someone goes to www.mydomain.com it will forward > them to mydomain.com. I am running nginx, and thin, not sure if I do > it in routes, in my nginx config file...? let me know if anyone has > any insight to this. thanks.AFAIK this is purely a web server/DNS configuration issue and has nothing to do with Rails. -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The best way to do this is through a .htaccess file. That will do it with only 3 or 4 lines of code. A quick google search will get you what you need. Sean McGilvray Sent from my iPhone On Feb 23, 2009, at 4:57 PM, Robert Walker <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > wrote:> > Dan Paul wrote: >> So i have a rails app running in 2.0.2 and I would like to know if >> anyone can point me in the right direction on how to remove the www >> from the url. so if someone goes to www.mydomain.com it will forward >> them to mydomain.com. I am running nginx, and thin, not sure if I do >> it in routes, in my nginx config file...? let me know if anyone has >> any insight to this. thanks. > > AFAIK this is purely a web server/DNS configuration issue and has > nothing to do with Rails. > -- > Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, Feb 23, 2009 at 2:07 PM, Dan Paul <danpaul01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > So i have a rails app running in 2.0.2 and I would like to know if > anyone can point me in the right direction on how to remove the www > from the url. so if someone goes to www.mydomain.com it will forward > them to mydomain.com. I am running nginx, and thin, not sure if I do > it in routes, in my nginx config file...? let me know if anyone has > any insight to this. thanks.Dan, For apache: RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com$1 [R=301,L] For nginx: #rewrites http://www.example.com/foo => http://example.com/foo if ($host ~* www\.(.*)) { set $host_without_www $1; rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains ''/foo'', not ''www.example.com/foo'' } Good luck! Cheers, Robby -- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting w/Ruby on Rails http://planetargon.com/ http://robbyonrails.com/ http://twitter.com/planetargon aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, Feb 23, 2009 at 6:30 PM, Robby Russell <robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote:> On Mon, Feb 23, 2009 at 2:07 PM, Dan Paul <danpaul01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> So i have a rails app running in 2.0.2 and I would like to know if >> anyone can point me in the right direction on how to remove the www >> from the url. so if someone goes to www.mydomain.com it will forward >> them to mydomain.com. I am running nginx, and thin, not sure if I do >> it in routes, in my nginx config file...? let me know if anyone has >> any insight to this. thanks. > > Dan, > > For apache: >Forgot to mention that RewriteEngine needs to be turned on. Example: :-) RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.planetargon\.com$ [NC] RewriteRule ^(.*)$ http://planetargon.com$1 [R=301,L]> RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] > RewriteRule ^(.*)$ http://example.com$1 [R=301,L] > > For nginx: > > #rewrites http://www.example.com/foo => http://example.com/foo > if ($host ~* www\.(.*)) { > set $host_without_www $1; > rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 > contains ''/foo'', not ''www.example.com/foo'' > } >Cheers, Robby -- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting w/Ruby on Rails http://planetargon.com/ http://robbyonrails.com/ http://twitter.com/planetargon aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---