Object
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
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
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
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
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
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
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
Generated with the Darkfish Rdoc Generator 2.