Forum Discussion

JeffRay_129268's avatar
JeffRay_129268
Icon for Nimbostratus rankNimbostratus
Nov 19, 2015

uri redirect

Hi Dears, will really appreciate your support in this.

I want to redirect a keyword and let the whole uri / URL remain as it is. for example keyword superb when found anywhere in uri then it should be redirected to same uri with replaced keyword with wonderful. It should be redirect instead of rewrite. I have tried some options but it redirects to same uri.

if { [HTTP::path] contains "/superb/" } {

HTTP::redirect "https://www.hypecolors.ae/en/wonderful/default.aspx"

Thanks.

2 Replies

  • Give this a whirl:

    when HTTP_REQUEST {
        if { [string tolower [HTTP::path]] contains "/superb/"}{
            HTTP::respond 302 noserver Location "https://[HTTP::host][string map -nocase {superb wonderful} [HTTP::path]]"
        }
    }
    
  • Excellent Brand, it worked like a magic. Bundle of thanks for your outstanding solution. :).