Try to follow 301/302 redirected URLs

I attempted to add 301 redirection support but I don't really know Lua and this does not seem to work :) If someone help me on that, I would appreciate.