Ruby on Rails Monday, June 28, 2010

Hi Max,

On Mon, Jun 28, 2010 at 6:51 AM, Max Williams <lists@ruby-forum.com> wrote:
> Hi all.  I'm moving our site from eg <domain>/staging/<rest of path> to
> simply be
> <domain>/<rest_of_path>.  I want to catch all the people who have
> bookmarked the "staging/" urls (or have them in their browser history)
> and redirect them to the equivalent url without "staging/".  Eg if
> someone goes to
>
> <domain>/staging/foos/123/edit
>
> it will send them to
>
> <domain>/foos/123/edit
>
> Is this something i can do in routes.rb?

Easily, with named routes.

> Or is it better done at the server config level?

I'm pretty sure you could do it with mod_rewrite rules. And that
would keep your routes.rb smaller, so 'better' in that sense. OTOH,
it's probably a worthwhile effort to do it with routes first, just to
make sure you identify any edge cases. My advice would be to make the
final decision based on your Apache config experience / comfort level.
Mine's minimal ;-)

Best regards,
Bill

--
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@googlegroups.com.
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.

No comments:

Post a Comment