Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

LTM iRule to redirect root domain to cname?

bryan_p
Nimbostratus
Nimbostratus

Doing some research and finding the inverse of this request.

Is it possible to have an iRule to redirect traffic destined for the root domain to a cname value?  Example-

website.com -> www.website.com

This VIP ultimately resolves to several external root domains, so ideally looking for something that would function for multiple domains.

website1.com -> www.website1.com
website2.com -> www.website2.com
website3.com -> www.website3.com

Thank you!

1 REPLY 1

JRahm
Community Manager
Community Manager

If my assumption is correct that you're looking for an HTTP redirect here, this would be most simply:

 

when HTTP_REQUEST {
  if { [llength [split [HTTP::host] "."]] == 2 } {
    HTTP::redirect https://www.[HTTP::host]
  }
}