Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

James Robertson http://www.r0bertson.co.uk

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Redirect a URL with Ruby CGI

#!/usr/bin/ruby

require 'cgi'

cgi = CGI.new
print cgi.header({'Status' => '302 Moved', 'location' =>  'http://www.wired.com'})

or
url = 'http://www.wired.com/'
print cgi.header({'status'=>'REDIRECT', 'Location'=>url})


References:
RE: cgi redirect [nagaokaut.ac.jp]
Ruby/CGI - assari [mokehehe.com]
HTTP/1.1: Status Code Definitions [w3.org]
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS