Created
March 30, 2012 23:21
-
-
Save dpickett/2257788 to your computer and use it in GitHub Desktop.
rewrite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run lambda do |env| | |
req = Rack::Request.new(env) | |
Rewrite.find_each do |rewrite| | |
if request.path =~ Regexp.new(rewrite.source) | |
return [301, {'Content-Type'=>'text/html', 'Location'=>"#{rewrite.destination}"}, ['Redirecting...']] | |
end | |
end | |
super | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment