Forum Discussion

Internet_Suppo1's avatar
Internet_Suppo1
Icon for Nimbostratus rankNimbostratus
Dec 23, 2015

iRule for https redirect - redirects every URL back to homepage

I've setup an iRule to redirect https://www.aibgb.aibtest.ie to https://aibgb.aibtest.ie. The problem is that when I try to access https://www.aibgb.aibtest.ie/ibhelp it gets redirected to https://aibgb.aibtest.ie instead of https://aibgb.aibtest.ie/ibhelp

 

What do I need to modify in my iRule so it keeps the additional folder suffixes and not direct every URL with the domain name in it back to the homepage as it is currently doing?

 

Here is my irule;

 

when HTTP_REQUEST { if { ([HTTP::host] equals "www.aibgb.aibtest.ie") } { HTTP::redirect "https://aibgb.aibtest.ie" } }

 

4 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    What about something like this:

    when HTTP_REQUEST { 
        if {[string tolower [HTTP::host]] equals "www.aibgb.aibtest.ie" } { 
        HTTP::respond 301 Location "https://aibgb.aibtest.ie[HTTP::uri]" 
     } 
    }
    

    See if this works for you.

    N