Forum Discussion

Joe_Wiitala_190's avatar
Joe_Wiitala_190
Icon for Nimbostratus rankNimbostratus
Nov 19, 2015

301 Redirect only the root URL nothing underneath.

I have a site where I'd like to only redirect the top URL but nothing underneath.

 

For example somone goes to www.xxx.com and gets a 301 redirect but if the go to www.xxx.com/test it will take them to the specified location

 

this redirects but redirects everything

 

switch [string tolower [HTTP::host]] { "www.xxx.com" - "xxx.com" - "www.yyy.com" {HTTP::respond 301 Location ""}

 

2 Replies

  • if your ltm version is 11.4 or above, you can use local traffic policies with both http-host and http-uri conditions instead of configuring irules.

     

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Joe,

    You'll need to put in some logic to capture the URI too. Something like

    if { [HTTP::uri] eq "/"}{

    You could place this above your switch command.

    Hope this helps,

    N