Forum Discussion

MattC_58842's avatar
MattC_58842
Icon for Nimbostratus rankNimbostratus
Nov 29, 2011

HTTP redirect ?

Today I have a I-rule that has 1 URL redirect , im trying to figure out how to add multiple lines in this i-rule.

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] contains "eprospectusdirect.com"} {

 

HTTP::redirect "http://dstoutput.com/product/eprospectusdirect"

 

} else {

 

pool wdc-docorpws-5000

 

}

 

}

 

 

 

 

Now i want to add more urls and im not sure of the syntax

 

 

Want to add these to current I-rule

 

 

We'd like: dstmailingservices.com to point to:http://dstoutput.com/product/presort-services

 

 

 

And statementpacks.com to point to: http://dstoutput.com/statementpacks/index.html

 

 

2 Replies

  • Hi MattC,

    You can use a switch statement. Try this:

    
    when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::host]] {
    "*eprospectusdirect.com" { HTTP::redirect "http://dstoutput.com/product/eprospectusdirect" }
    "*dstmailingservices.com" { HTTP::redirect "http://dstoutput.com/product/presort-services" }
    "*statementpacks.com" { HTTP::redirect "http://dstoutput.com/statementpacks/index.html" }
    default {
    pool wdc-docorpws-5000
    }
    }
    }
    

    Just wanted to point out that according to the RFC Standards, the [HTTP::host] value should be case insensitive, but performing a string tolower anyway catches all compliant and non-compliant browsers.

    Hope this helps.