Forum: Ruby on Rails Can I let routes.rb take precedence over file names?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
39045f22049b1db3e3dd08c3bffac17e?d=identicon&s=25 Filip Godsmurf (godsmurf)
on 2006-02-28 23:15
I'd like Rails to intercept the url's of html pages in a certain
directory so I can embed them in my site. I put them in public/pages and
tried to catch them with a route like

  map.connect 'pages/:pagename'

However this only works if the file does not exist; e.g.
"pages/test.html" will only be routed if that file doesn't exist,
otherwise it will just show the file.

Is there any other way I can reroute url's of existing html files?

The reason I need to use the real directory and file names is that these
html pages contain images and cross-links which still need to work.
55428cbf149e35dd4b65f1d019d04139?d=identicon&s=25 Matthew Palmer (Guest)
on 2006-03-01 07:47
(Received via mailing list)
On Tue, Feb 28, 2006 at 11:15:16PM +0100, Filip Godsmurf wrote:
> Is there any other way I can reroute url's of existing html files?
>
> The reason I need to use the real directory and file names is that these
> html pages contain images and cross-links which still need to work.

I don't understand why you need to have the filenames still exist in
public/pages.  If you need to access their content, you can stick them
somewhere else (out of public).

I'd be very leery of having Rails handle every single request -- you'd
need
to add some sort of generic magic to serve out the static files, as once
the
webserver has handed control off to Rails, I don't think Rails can throw
back to the webserver and say "I don't want this one, you take it".

- Matt
This topic is locked and can not be replied to.