Forum Discussion

5 Replies

  • Hi Edgar,

    Here's an example you can use:

    
    when HTTP_REQUEST {
    if {[string tolower [HTTP::host]] ne "www.mysite.com"} {
    HTTP::redirect "http:://www.mysite.com[HTTP::uri]"
    }
    }
    

    Aaron
  • Thanks hoolio!

     

     

    Is that the correct word: 'ne'? What does it mean?

     

     

    Thanks again. I will be able to try this code a little later today and let you know if it works as expected.
  • Hi Edgar,

     

     

    The "ne" is "not equal". You can also use an "!".

     

     

    It can be expressed several different ways:

     

    if {[string tolower [HTTP::host]] ne "www.mysite.com"} {

     

    or

     

    if {!([string tolower [HTTP::host]] ne "www.mysite.com")} {

     

    or

     

    if {[string tolower [HTTP::host]] != "www.mysite.com"} {

     

     

    Hope this helps.
  • Actually, I overlooked the fact that we connect to www.mysite.com internally. Can I add an exception to the iRule so requests to www.mysite.mydomain.com go through?

     

     

    Thank you for your time.