Forum Discussion

AbhijitVichare's avatar
Icon for Nimbostratus rankNimbostratus
May 23, 2022

iRule for URL redirect



Can someone please help me with an iRule for URL redirection. 

Source URL -{C2827ADC-C4B5-4B62-9024-C7848E7CAF5F}

Target redirect URL -


Note - Target URL redirect has docid value which need sto be taken from the source URL and also the { and } in the source URL docid value needs to be conver their ascii values accordingly.


Thanks in advance!


1 Reply

  • I'm just learning iRules myself but will try to help.  There should be a pre-installed redirect Irule on the LTM.  I found one named "_sys_https_redirect".  Looks like this.

    # Copyright 2003-2006, 2012-2013, 2016, 2019. F5 Networks, Inc. See End User License Agreement ("EULA")
    # for license terms. Notwithstanding anything to the contrary in the EULA,
    # Licensee may copy and modify this software product for its internal business
    # purposes. Further, Licensee may upload, publish and distribute the modified
    # version of the software product on
    when HTTP_REQUEST {
    HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]

    Below is one of my companies redirects.

    when HTTP_REQUEST {
    if { [string tolower [HTTP::host]] equals "????.com" } {
    HTTP::respond 301 Location "https://???.com[HTTP::uri]"


    Hope this helps.