[Rails] Re: URL Redirect and affect on Routes?

2009-04-15 Thread Jason

Thanks, I figured this should be a Rewrite rule but was not familiar
enough with rails/routes to determine if I was making it more
complicated. I feel pretty confident in working with Apache.

Thanks much!

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: URL Redirect and affect on Routes?

2009-04-14 Thread Andrew Timberlake

On Wed, Apr 15, 2009 at 4:43 AM, Jason mccreary.ja...@gmail.com wrote:

 I still don't fully understand routes, so I apologize in advance.

 I have a single rails app, but multiple domains pointing to different
 directories for marketing reasons. I am looking for a way to have the
 secondary domain point to the primarydomain.com/directory.

 It'd want any links to primarydomain.com/directory to 301 redirect to
 the secondary domain. Essentially, to the user everything should look
 like secondarydomain.com/whatever but be primarydomain.com/directory/
 whatever on the server.

 How can I handle this without affecting routes?

 Thanks,
 Jason

I would handle this in the upline webserver like Apache or Nginx with
url rewriting

The primary domain can catch all calls to the directory and 301 them
to the subdomain without passing the call through to Rails
Rewrite the subdomain/whatever and pass it to RAILS/directory/whatever

This way Rails only has to deal with the call to the directory and can
safely ignore the primary domain handling (and avoid changing routes)

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

I have never let my schooling interfere with my education - Mark Twain

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---