Forum Discussion

Andrea_Arquint's avatar
Icon for Nimbostratus rankNimbostratus
Oct 21, 2010

How to replace the hostname from a FQDN in HTTP:HOST




How is it possible to replace only the hostname within an irule?








Client requests so [HTTP:Host] contains this name.


How can I replace only the "www" with "www2" and response to the client?




Many thanx




4 Replies

     when HTTP_REQUEST { 
         if { [string tolower [HTTP::host]] eq "" } { 
              HTTP::redirect "[HTTP::uri]" } } 

    That'll send a redirect to the client for www2.
  • Hi Chris



    I probably did not clear explain what I need.




    For example:




    we have some domains...








    Now I want to get only the domains to create a new one like:




    In case of





    In case of







    This should be more dynamically then with a "switch" method:




    I think should be something like...




    set dom [HTTP:Host]


    extract only the domain in this case build the new FQDN.






    I hope I did clearly describe what I mean.






    Many thanx




  • You were there and you didn't know it! The domain command is your friend: Click Here



    So you would want something like this: www2.[domain [HTTP::host] 2]