Hi guys. I''m using the following rule to point users to www.mydomain.com instead of mydomain.com. RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,QSA,L] But it doesn''t work. Accessing mydomain.com yields just that. Any ideas? -- 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 5/17/07, Daniel Waite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi guys. I''m using the following rule to point users to www.mydomain.com > instead of mydomain.com. > > RewriteEngine On > RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ > RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,QSA,L] > > But it doesn''t work. Accessing mydomain.com yields just that.Here''s a working version I have on my laptop: RewriteCond %{HTTP_HOST} ^localhost$ [NC] RewriteRule ^(.*)$ http://www.localhost/$1 [L,R=301] -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
Greg Donald wrote:> RewriteCond %{HTTP_HOST} ^localhost$ [NC] > RewriteRule ^(.*)$ http://www.localhost/$1 [L,R=301]Nay, still not working. No errors, no time outs, httpd restarts okay. It just doesn''t write ''www'' into the address bar. Initially I was putting these rules right above my vhost directive. I then tried moving it into my vhost directive directly beneath the RewriteEngine On part. =( -- 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 5/17/07, Daniel Waite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Greg Donald wrote: > > RewriteCond %{HTTP_HOST} ^localhost$ [NC] > > RewriteRule ^(.*)$ http://www.localhost/$1 [L,R=301] > > Nay, still not working. No errors, no time outs, httpd restarts okay. It > just doesn''t write ''www'' into the address bar. > > Initially I was putting these rules right above my vhost directive. I > then tried moving it into my vhost directive directly beneath the > RewriteEngine On part.Yeah, you have to use those rules first or some other rules might fire first instead. Does this help? RewriteLogLevel 9 RewriteLog logs/rewrite.log -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
mcintyre.tim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-17 21:39 UTC
Re: Using mod_rewrite to add ''www'' to urls
post.gsub!(/RoR: Talk/, "Apache: Talk") On May 17, 1:35 pm, Daniel Waite <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi guys. I''m using the following rule to point users towww.mydomain.com > instead of mydomain.com. > > RewriteEngine On > RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ > RewriteRule ^(.*)$http://www.mydomain.com/$1[R=301,QSA,L] > > But it doesn''t work. Accessing mydomain.com yields just that. > > Any ideas? > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Greg Donald wrote:> Does this help? > > RewriteLogLevel 9 > RewriteLog logs/rewrite.logNay. I assume it would create the logs directory if it didn''t already exist? It doesn''t. By the way, I dig your site. :) Hi guest. I thought about that before posting, but I figured I would post here in case anyone using Rails has come across some weirdness with Rails and mod_rewrite. Alas, your suggestion is valid, and I shall go find an Apache tribe to talk to. -- 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 5/17/07, Daniel Waite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Greg Donald wrote: > > Does this help? > > > > RewriteLogLevel 9 > > RewriteLog logs/rewrite.log > > Nay. I assume it would create the logs directory if it didn''t already > exist? It doesn''t.I always have to make an explicit entry to get rewrite logs.> By the way, I dig your site. :)Thanks. It''s just a little something I threw together one afternoon. :) -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
Out of curiosity, why would you want to make the canonical URI have www appended to it? For me, it seems so antiquated like ooooh double u double u double u dot ... That''s just me though. I''m legitimately curious about any benefits [perceived or actual] for the extra www. RSL On 5/17/07, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 5/17/07, Daniel Waite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > Greg Donald wrote: > > > Does this help? > > > > > > RewriteLogLevel 9 > > > RewriteLog logs/rewrite.log > > > > Nay. I assume it would create the logs directory if it didn''t already > > exist? It doesn''t. > > I always have to make an explicit entry to get rewrite logs. > > > By the way, I dig your site. :) > > Thanks. It''s just a little something I threw together one afternoon. :) > > > -- > Greg Donald > http://destiney.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 -~----------~----~----~----~------~----~------~--~---