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

Forum Discussion

Bob_10976's avatar
Bob_10976
Icon for Nimbostratus rankNimbostratus
Oct 22, 2008

Redirecting Only Specfic URL Address

Hello All,

 

 

I've been task to setup a iRule that will redirect a url, subsite.mysite.com to mysite.com It actually seems pretty simple but the problem is subsite.mysite.com typically has a trailing site, actually a ton of training sites or services, meaning it looks like subsite.mysite.com/webservice or subsite.mysite.com/application. When I create a redirect iRule it ends up redirecting everything and I only want it to apply if the url matches subsite.mysite.com excatly, anything else shouldn't be redirected. Below is an example of the iRules I attempted but didn't get to work.

 

 

Any thoughts or suggestion would be appreciated...

 

 

when HTTP_REQUEST {

 

if { ([string tolower [HTTP::host]] equals "subsite.mysite.com ") || ([string tolower [HTTP::host]] equals "www.subsite.mysite.com ")} {

 

 

if { ([string tolower [HTTP::host]] equals "subsite.mysite.com ") || ([string tolower [HTTP::host]] equals "www.subsite.mysite.com ") } {

 

HTTP::respond 301 Location http://mysite.com/

 

}

 

 

}

 

 

}

 

 

AND

 

 

when HTTP_REQUEST {

 

if { ([string tolower [HTTP::host]] equals "subsite.mysite.com ") || ([string tolower [HTTP::host]] equals "www. subsite.mysite.com ")} {

 

HTTP::respond 301 Location http://mysite.com/

 

 

}

 

 

}

 

 

I did try a trailing slash (/) at the end of "subsite.mysite.com " but that didn't seem to make a difference.

 

 

Thanks in advance..

 

 

Bob

 

6 Replies

No RepliesBe the first to reply