It's not supposed to work, unless client has a route to 10.1.1.1. Client must either be in the local network, or have some sort of VPN connectivity to 10.1.1.1 from a 3rd party site.
iRule is correct and it does work on any virtual server with HTTP profile attached. I'm sure you also use it in the correct event (when HTTP_REQUEST). My only suggestion is to use the "event disable" and "TCP::close" commands after the redirect statement (required for the redirect functionality to work the same in case user opens multiple tabs).