Ramaze::Route( 'stripper' ) do |path, request|
match, path = %r|^/+index.php|.match(request.path_info).to_a
path if match
end
or similar should do - this simply nukes it off the front of all
incoming requests and re-routes.
this works only for controllers though - if you are serving static
files (css, etc) you may need to write a custom dispatcher to replace
the current File::Dispatcher...
cheers.
a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama
> Ramaze::Current.before do
> Ramaze::Request.current.env.each do |key,val|
> val.sub!(%r|^/index.php|, '')
> end
> end
i'm not sure that'll work - before fires after the request has been
setup... maybe it should be moved?
> Just tried it, and this seems to work:
okay cool - did you try a static request? /css/site.css ??
>
> Ramaze::Rewrite[%r|^/index.php(.*)$|] = "%s"
> Ramaze.start :adapter => :mongrel
>
> Rewrites are run after the file dispatcher however, so static file
> requests will not work with this approach.
>
oh that's very cool.
i like
Rewrite %r|^/index.php(.*)$| => "%s"
as a syntax though
it'd also be cool to have them run before file dispatching... being
able to alter static requests in ramaze is very very powerful.
> Agreed, the only issue is that those rewrites will be ignored if you
> setup nginx/lighty/apache in front of your ramaze instance to serve
> static files. That's probably fine though... it's your job to
> replicate those rewrites in your front-end proxy.
yup, exactly. no way around it i think - if you have crazy complex
static serving, like for a site of sites, you would indeed have to
replicated that logic or just let ramaze do it. ramaze does it very
well know, with minimal pain. but easier is always better ;-)