Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

iRule for HTTP redirect from retired URL to new HTTPS URL


Hi Experts,


I'm new to F5 and could someone please help.  Here is what I'm trying to accomplish...

We have a web site that is retiring and will be replaced with a new site. We would like to do an Http redirect (301) to the new site when someone hits the old URL.

We want the URL in the users address bar to change to the new address. The existing URL is HTTP but the new URL is HTTPS (some external URL).


Basic functionality: User goes to Redirect is sent to send user to


Can you guys please assist.. Thanks in advance.



Try this iRule. It will work per your requirement. Let us know if any question


when HTTP_REQUEST { if { [HTTP::host] equals "" } { HTTP::redirect "" } }


Thanks Samir, Hope this is Permanent re-direct (301).


And please be informed, the new URL is external public URL and hope no extra config required at the F5 or firewall rules..

Above irule will redirected traffic if any user access "" but again you need enable firewall rule for new site "".


Will suggest you check the access "" in browser before placing irule else will not work.

Thanks for the reply. The confusion around here is, new site "" isn't managed by our network. This is some external URL, so whether firewall rules are required...?


And, once the old URL is retired, hope we're good to remove the public DNS as well..

And to keep you informed, this is not working. I've applied this but no luck 😞