Forum Discussion

OCC_68606's avatar
OCC_68606
Icon for Nimbostratus rankNimbostratus
May 24, 2011

iRule 301 Location

Hi Everybody,

 

 

I am looking for a way to the following:

 

 

 

I want to manage several sites and send it with a permanent redirect to general site, for example:

 

 

When I enter www.site1.com, www.site2.com, www.site3.com, etc. redirecto to www.generalsite.com

 

 

I made the following iRule:

 

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::host]]{

 

"www.site1.com" -

 

"www.site2.com" -

 

"www.site3.com" {

 

HTTP::respond 301 Location "http://www.generalsite.com[HTTP::uri]"

 

}

 

}

 

}

 

 

Any ideas???

 

 

George.

 

4 Replies

  • It´s working, but sometimes general site has problems to resolve, I put this iRule in VS for www.generalsite.com. What is wrong?

     

     

     

    Do you know another way to validate sites1, 2, 3 with or without "www"???

     

     

    Thanks.

     

     

    George

     

  • Couldn't you just extend the idea you had originally. Like this:

     

     

    switch -glob [string tolower [HTTP::host]] {

     

    "www.site1.com" -

     

    "www.site2.com" -

     

    "www.site3.com" -

     

    "site1.com" -

     

    "site2.com" -

     

    "site3.com" {

     

    HTTP::respond 301 Location "http://www.generalsite.com[HTTP::uri]"

     

    }

     

     

    Or did I misunderstand what you wanted to do?