I want to move my site elsewhere. So I thought I could throw in a Webrick instance to serve as a 301 redirector on the old port and send all the traffic to the new site. I''ve got the headers["status"]="301 moved permanently" and the redirect_to "http://www.newsite.com" but what''s happening is that the basic URL (mysite.com/blog) is being redirected (my controller is /blog), but more complex urls like /blog/2005/09/07/abc.html are getting a "recognition failed" error. Makes sense since there is no "2005" action. Is there a trick I need to do in order to send every url from the old site to the new one? While I''m in there, since my url pattern will be staying the same, am I going to be able to keep that information as part of the redirect or do I have to redirect to the main page of my new site? In other words can I go from oldsite.com/blog/2005/09/07/abc.html to newsite.com/2005/09/07/abc.html ? Thanks! -- 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 -~----------~----~----~----~------~----~------~--~---
> Is there a trick I need to do in order to send every url from the old > site to the new one? While I''m in there, since my url pattern will be > staying the same, am I going to be able to keep that information aspart> of the redirect or do I have to redirect to the main page of my new > site? In other words can I go fromoldsite.com/blog/2005/09/07/abc.html> to newsite.com/2005/09/07/abc.html ? > > Thanks!# Static content control map.connect ''/protected/*path'', :controller => ''protected'', :action => ''render_static'' I use this to force any /protected URL to controller protected, action static. I suspect you could (not tested) Map.connect ''/*path'', :controller => ''redirect'', action => ''redirect'' This map should put the whole URL in to params[:path], and call controller redirect, method redirect for every one. You should be able to construct an appropriate redirect from that. Be sure to clear out /public so that rails gets the hits. A simpler way might be to configure a redirect in your web server. Apache and lighty can do this. Regards, Rich --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If you''re using Apache, all you need is this in oldsite.com''s root .htaccess: Redirect permanent /blog http://www.newsite.com This will catch all the stuff under /blog and pass it along to newsite. Should be doable in Lighttpd as well, but I''m stuck on Apache at the moment... On 9/18/06, Duane Morin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I want to move my site elsewhere. So I thought I could throw in a > Webrick instance to serve as a 301 redirector on the old port and send > all the traffic to the new site. I''ve got the headers["status"]="301 > moved permanently" and the redirect_to "http://www.newsite.com" but > what''s happening is that the basic URL (mysite.com/blog) is being > redirected (my controller is /blog), but more complex urls like > /blog/2005/09/07/abc.html are getting a "recognition failed" error. > Makes sense since there is no "2005" action. > > Is there a trick I need to do in order to send every url from the old > site to the new one? While I''m in there, since my url pattern will be > staying the same, am I going to be able to keep that information as part > of the redirect or do I have to redirect to the main page of my new > site? In other words can I go from oldsite.com/blog/2005/09/07/abc.html > to newsite.com/2005/09/07/abc.html ? > > Thanks! > > > >-- Matt Jones mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org President/Technical Director, Acme Art Company (acmeartco.org) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > Is there a trick I need to do in order to send every url > from the old > > site to the new one? While I''m in there, since my url > pattern will be > > staying the same, am I going to be able to keep that information as > part > > of the redirect or do I have to redirect to the main page of my new > > site? In other words can I go from > oldsite.com/blog/2005/09/07/abc.html > > to newsite.com/2005/09/07/abc.html ? > > > > Thanks! > > A simpler way might be to configure a redirect in your web server. > Apache and lighty can do this.Agreed. If you have apache, this is a 3-line .htaccess file in your webroot: RewriteEngine on RewriteCond %{HTTP_HOST} oldsite.com RewriteRule ^(.*) http://www.newsite.com$1 An even simpler way is to re-point oldsite.com to newsite.com in DNS, unless you specifically wanted the 301 step inbetween. - Mark. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---