Forum Discussion

bvinson_12764's avatar
bvinson_12764
Icon for Nimbostratus rankNimbostratus
Nov 02, 2009

Domain Redirect

Hello,

 

 

Pretty new to Irules,

 

 

How do I,,,

 

 

I have a new domain and a old domain that point to the same Web services.

 

 

lets call them new.com and old.com

 

 

I would like it when users access web.old.com to be redirected to web.new.com. I need the name change because of SSL naming.

 

 

Any suggestions?

 

 

Many Thanks

 

You guys are awesome

 

:D

3 Replies

  • Here is a simple redirection of a domain name

     
     when HTTP_REQUEST { 
        if {[HTTP::host] eq "web.old.com" } { 
           HTTP::redirect "http://web.new.com/[HTTP::uri]/" 
           } 
     } 
     

    I hope this helps

    CB

  • Thanks for the response;

     

     

    is there a way to build on for a general domain.

     

    by that I mean one that could be used for any host

     

    *.old.com to *.new.com?

     

     

     

  • I suppose you can do the following

     
     when HTTP_REQUEST { 
       if { [HTTP::host] contains "old.com"} { 
         HTTP::redirect http://[getfield [HTTP::host] ".old.com" 1].new.com[HTTP::uri] 
       } 
     }