| Class | Mongrel::RedirectHandler |
| In: |
lib/mongrel/handlers.rb
|
| Parent: | Mongrel::HttpHandler |
This handler allows you to redirect one url to another. You can use it like String#gsub, where the string is the REQUEST_URI. REQUEST_URI is the full path with GET parameters.
Eg. /test/something?help=true&disclaimer=false
h = Mongrel::HttpServer.new('0.0.0.0')
h.register '/test', Mongrel::RedirectHandler.new('/to/there') # simple
h.register '/to', Mongrel::RedirectHandler.new(/t/, 'w') # regexp
# and with a block
h.register '/hey', Mongrel::RedirectHandler.new(/(\w+)/) { |match| ... }