Forum Discussion

ucgwebmaster_95's avatar
ucgwebmaster_95
Icon for Nimbostratus rankNimbostratus
Dec 01, 2008

Multiple Redirects

I have several Host Headers setup in IIS for one website:

 

 

ex: nnn.sitename.com

 

 

 

I need to write a rule for www.nnn.sitename.com to redirect to nnn.sitename.com

 

 

This needs to be done for at least 10 URL's.

 

 

What would be the best way to tackle this?

 

 

 

Thank you in Advance!!!

3 Replies

  • if it is always the same format like www.[host] need to be redirected to [host] then a simple iRule that extract the first part should do the job

    But if it is not so consistent, you can build a datagroup which says for each host what should be the redirect

    ex:

     
     this class definition is what you see in your bigip.conf file when you define a datagroup 
     class hostredirects { 
       "www.nnn.sitename.com http://nnn.sitename.com" 
       "www.nan.sitename.com http://someotherhost.nowhere.com" 
     } 
      
     when HTTP_REQUEST { 
       set location [findclass [HTTP::uri] $::hostredirects " "] 
       if { $location ne "" } 
         HTTP::redirect $location  
       } 
     } 
      
     
  • I am still learning my way around the BigIp. Where do I define this data group? Also,removing the www sounds like a good option. Can you show me an example?
  • In the GUI it is a tab in the iRules section at the top of the editing window. In the CLI, it is called a class, and can be defined with the bigpipe class command.