Parent

Class/Module Index [+]

Quicksearch

Rack::Rewrite::RuleSet

Attributes

rules[R]

Protected Instance Methods

found(*args) click to toggle source
Alias for: r302
moved_permanently(*args) click to toggle source
Alias for: r301
p(*args) click to toggle source
Alias for: r301
r301(*args) click to toggle source

Creates a redirect rule that will send a 301 when matching.

r301 '/wiki/John_Trupiano', '/john'
r301 '/contact-us.php', '/contact-us'

You can use moved_permanently or just p instead of r301.

# File lib/rack/rewrite/rule.rb, line 32
def r301(*args)
  add_rule :r301, *args
end
Also aliased as: moved_permanently, p
r302(*args) click to toggle source

Creates a redirect rule that will send a 302 when matching.

r302 '/wiki/John_Trupiano', '/john'
r302 '/wiki/(.*)', 'http://www.google.com/?q=$1'

You can use found instead of r302.

# File lib/rack/rewrite/rule.rb, line 45
def r302(*args)
  add_rule :r302, *args
end
Also aliased as: found
r303(*args) click to toggle source

Creates a redirect rule that will send a 303 when matching.

r303 '/wiki/John_Trupiano', '/john'
r303 '/wiki/(.*)', 'http://www.google.com/?q=$1'

You can use see_other instead of r303.

# File lib/rack/rewrite/rule.rb, line 57
def r303(*args)
  add_rule :r303, *args
end
Also aliased as: see_other
r307(*args) click to toggle source

Creates a redirect rule that will send a 307 when matching.

r307 '/wiki/John_Trupiano', '/john'
r307 '/wiki/(.*)', 'http://www.google.com/?q=$1'

You can use temporary_redirect or t instead of r307.

# File lib/rack/rewrite/rule.rb, line 69
def r307(*args)
  add_rule :r307, *args
end
Also aliased as: temporary_redirect, t
rewrite(*args) click to toggle source

Creates a rewrite rule that will simply rewrite the REQUEST_URI, PATH_INFO, and QUERY_STRING headers of the Rack environment. The user's browser will continue to show the initially requested URL.

rewrite '/wiki/John_Trupiano', '/john'
rewrite %r{/wiki/(\w+)_\w+}, '/$1'
rewrite %r{(.*)}, '/maintenance.html', :if => lambda { File.exists?('maintenance.html') }
# File lib/rack/rewrite/rule.rb, line 22
def rewrite(*args)
  add_rule :rewrite, *args
end
see_other(*args) click to toggle source
Alias for: r303
send_file(*args) click to toggle source

Creates a rule that will render a file if matched.

send_file /*/, 'public/system/maintenance.html',
  :if => Proc.new { File.exists?('public/system/maintenance.html') }
# File lib/rack/rewrite/rule.rb, line 80
def send_file(*args)
  add_rule :send_file, *args
end
t(*args) click to toggle source
Alias for: r307
temporary_redirect(*args) click to toggle source
Alias for: r307
x_send_file(*args) click to toggle source

Creates a rule that will render a file using x-send-file if matched.

x_send_file /*/, 'public/system/maintenance.html',
  :if => Proc.new { File.exists?('public/system/maintenance.html') }
# File lib/rack/rewrite/rule.rb, line 89
def x_send_file(*args)
  add_rule :x_send_file, *args
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.