Forum Discussion

Bob_10976's avatar
Bob_10976
Icon for Nimbostratus rankNimbostratus
May 22, 2012

WWW Redirect with URI String

I have a WWW redirect in place that works, however when a user goes to www.domain.com/something they are redirected to just domain.com vs going to domain.com/something.

 

 

How can I modify or create a new rule to make it work so they maintain the URI string/path after the redirect happens.

 

 

I'm running 10.2.3 and my current rule is below:

 

 


when HTTP_REQUEST {
switch "[string tolower [HTTP::host]]" {
"www.domain.com" {
HTTP::respond 301 Location "http://domain.com"
}
}
}

[\code]
Thanks,
Bob

4 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Bob,

     

     

    Does this work by appending HTTP::uri?

     

     

    when HTTP_REQUEST {

     

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

     

    "www.domain.com" {

     

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

     

    }

     

    }

     

    }

     

     

    N
  • I get an error when I check the syntax:

     

     

    line 4: [parse error: extra characters after close-quote] [[HTTP::uri]]

     

     

    Thanks,

     

    Bob

     

     

     

  • Thanks Nathan..I see what the problem was now..Just moved my quote over and yes that did the trick..

     

     

    Thanks again!

     

    Bob
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Bob

     

     

    Sorry about that, should've checked my word - too quick to click Submit...more haste, less speed in future.

     

     

    Glad it works

     

     

    N