Forum Discussion

Angelo's avatar
Angelo
Icon for Nimbostratus rankNimbostratus
May 13, 2013

redirect Multiple URL's

Hi

 

 

I got a rule to redirect multiple URL's to anothers but i'm not sure if it's going to work..

 

 

 

when HTTP_REQUEST {

 

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

 

"www.test.com" { [string tolower [HTTP::uri]] "www.test201.net" }

 

"www.example.com" { [string tolower [HTTP::uri]] "www.example403.net" }

 

"www.something.com" { [string tolower [HTTP::uri]] "www.example403.net" }

 

"www.testing.com" { [string tolower [HTTP::uri]] "www.example403.net" }

 

default {

 

reject }

 

}

 

}

 

3 Replies

  • Hey Angelo,

     

     

    No it's not going to work. Are you looking to redirect or rewrite the URI or modify the HTTP Host header/domain name here?

     

  • Angelo's avatar
    Angelo
    Icon for Nimbostratus rankNimbostratus
    it's will have to be a redirect to another site...
  • OK, so this should do it whilst preserving the original request URI;

    
    when HTTP_REQUEST {
    switch [string tolower [HTTP::host]] {
    "www.test.com" { HTTP::redirect "http://www.test201.net[string tolower [HTTP::uri]]" }
    "www.example.com" { HTTP::redirect "http://www.example403.net[string tolower [HTTP::uri]]" }
    "www.something.com" { HTTP::redirect "http://www.example403.net[string tolower [HTTP::uri]]" }
    "www.testing.com" { HTTP::redirect "http://www.example403.net[string tolower [HTTP::uri]]" }
    default {
    reject }
    }
    }