This might be a good time to mention that with the rails 3 redesign,
you can specify much more powerful constraints from within the router.
Katz's website has a nice article on it:
http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/

The part I found most interesting was this:

Basecamp::Application.routes do
  constraints(:subdomain => "support") do
    match "/foo/bar", :to => "foo#bar"
  end
end

As it turns out, you can swap :hostname (or :host) into the place
of :subdomain and setup different routes for different domains.
Using this in combination with some sort of hostname checking in a
before_filter is all I needed for my project.  No need for any URL
rewriting in nginx.

Hope that helps.

On Oct 19, 9:21 am, bingo bob <li...@ruby-forum.com> wrote:
> Could well be overcomplicating things!
>
> Walter's point here is sounds closest I think - I'll try it.
>
> > You can do redirects that fundamentally rewrite the URL from the
> > server's perspective, without changing what the user sees in their
> > browser's location bar. So you could avoid the whole routes.rb hack
> > I've outlined above by rewriting requests for [www.]foo.com to baz.com/
> > property/1 [NS,QSA] (those flags keep the URL whatever was written in
> > the browser. Then the user could enterwww.foo.com/editand the
> > request would bewww.baz.com/property/1/editat your server.
>
> As it stands apache modrewrite in place but not finished - working
> though, :-)!
>
> http://www.chaletcordee.co.uk/
> as you will witness if you visit this is rewritten to this in the users
> browser...http://www.chaletcordee.co.uk/properties/1/
> Fine, content works but I'd like this to behttp://www.chaletcordee.co.uk/
> in the users browser
>
> in a similar manner
>
> http://www.apartmentnicole.co.uk/
> goes tohttp://www.apartmentnicole.co.uk/properties/2/
> I'd like this to behttp://www.apartmentnicole.co.uk/
> in the users browser
>
> if you click on the photos page after visitinghttp://www.chaletcordee.co.uk/
> you get here...http://www.chaletcordee.co.uk/properties/1/photos
> I'd like this to behttp://www.chaletcordee.co.uk/photos
> in the users browser, etc
>
> phew - is anyone still reading - I doubt it ! :-).
>
> --
> 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-t...@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.

Reply via email to