Mar 27, 2026 - For details about updated CVE-2025-53521 (BIG-IP APM vulnerability), refer to K000156741.

Forum Discussion

Grayson_149410's avatar
Grayson_149410
Icon for Nimbostratus rankNimbostratus
Jan 22, 2015
Solved

iRule 301 Redirect using Wildcard

We are currently running Sharepoint to host our public website. When the user types in www.company.com the URL gets updated to www.company.com/Pages/Home.aspx. This also applies to all other sites within it like www.company.com/Pages/Marketing (with several other flavors).

What I want is an iRule that will see if the user is going to www.company.com. Then change it to a HTTP respond 301 and to lower all strings. So instead of seeing www.company.com/Marketing.aspx they will get www.company.com/marketing.aspx.

Here is an irule that I have tried and does the 301 part, but it always implies the site is just www.company.com. I want to a /* somehow so that any site it sees, it lowers it and does a 301 redirect. here is my curreny rule.

when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
    "www.company.com" {
        HTTP::respond 301 Location "https://www.company.com[HTTP::uri]"
    }

I want it to see if it is www.company.com and if so anything added past the / when it gets added to the particular link it recognizes it.

  • How about this?

    when HTTP_RESPONSE {
        if {[HTTP::status] == 302}{
            HTTP::respond 301 Location "[string tolower [HTTP::header Location]]"
        }
    }
    

9 Replies

No RepliesBe the first to reply