Forum Discussion

Vince_Campbell_'s avatar
Vince_Campbell_
Icon for Nimbostratus rankNimbostratus
Apr 24, 2014

Changing url from abc.com to www.abc.com while maintaining all uri

I am trying to accommodate the developers by redirecting http://abc.com/ to http://www.abc.com/ and keeping everything after the "/".

 

So I would need http://abc.com/locations/ to be http://www.abc.com/locations and http://abc.com/any/ to be http://www.abc.com/any/

 

I have the following in place, but it is not working. when HTTP_REQUEST { if { [HTTP::host] equals "abc.com" } { HTTP::redirect "http://www.abc.com" } }

 

Any help would be appreciated.

 

1 Reply

  • Try this:

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