You can either follow
grinder 's advice. Or if you are working on windows then you can use
Win32::IE::Mechanize module. I guess this module can redirect the page, since it uses IE as user agent.
I am sorry for providing advice without testing from my end, (which i don't do). I work on Linux and currently facing some problem in accessing Window test machine through my rdesktop.