support both 301 and 302 redirects

This is important for Rails because when you setup a redirect in routes.rb, it uses a [301](http://guides.rubyonrails.org/routing.html#redirection).