Philip Hallstrom
2006-Jun-10 00:01 UTC
[Rails] Migrating to rails... best way to redirect old urls?
Hey all - I''m migrating an app from PHP to Rails and was wondering what the best way to redirect the old urls are. I would like to do a 301 as I''m told that makes Google the happiest. We''re using lighty as the server and I believe it has rewrite capabilities, but I can''t get to their site right now. Anyway, I''m wondering if it''s best handled in lighty? Or by adding a bunch of routes, or by having a handler catch what would be 404''s then run some custom code and if I can find a match, redirect them, otherwise, return 404. We have quite a few urls and I''d like to automatically map as many as possible. Seems like the last option would be best since it would only happen if rails didn''t catch it already.... Pointers? Suggestions? Thanks! -philip
carmen
2006-Jun-10 16:54 UTC
[Rails] Re: Migrating to rails... best way to redirect old urls?
> a handler catch what would be 404''s then run > some custom code and if I can find a match, redirect them, otherwise, > return 404.id stick with routes.rb rather than inventing your own, since it works quite well and you can constrain by regex if needed..> > We have quite a few urls and I''d like to automatically map as many as > possible.routes.rb for the ones youd like to keep, and send the rest to the 301/404 bin. redoing a drupal site in rails my threshold was do the names even make sense. eg /article/tagname was ditched, since id expect an articleid or shorturl to follow, not a tag... use your judgement, i''m sure its good.. -- Posted via http://www.ruby-forum.com/.
Ezra Zygmuntowicz
2006-Jun-10 19:24 UTC
[Rails] Migrating to rails... best way to redirect old urls?
On Jun 9, 2006, at 5:04 PM, Philip Hallstrom wrote:> Hey all - > > I''m migrating an app from PHP to Rails and was wondering what the > best way to redirect the old urls are. I would like to do a 301 as > I''m told that makes Google the happiest. > > We''re using lighty as the server and I believe it has rewrite > capabilities, but I can''t get to their site right now. > > Anyway, I''m wondering if it''s best handled in lighty? Or by adding > a bunch of routes, or by having a handler catch what would be 404''s > then run some custom code and if I can find a match, redirect them, > otherwise, return 404. > > We have quite a few urls and I''d like to automatically map as many > as possible. > > Seems like the last option would be best since it would only happen > if rails didn''t catch it already.... > > Pointers? Suggestions? > > Thanks! > > -philip > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsPhilip- There is a funny plugin out there called Legacy Interop. Which allows your to emulate your old urls. Check it out , it might help you transition your app over to rails. http://wiki.rubyonrails.com/rails/pages/Legacy+Interop -Ezra