In this example we going to redirect HTTP request coming for domain.com to http://www.domain.com using basic iRule.
Configuration steps:
1) Login to load balancer’s GUI
2) Go to Local Traffic -> iRules -> iRule List and click Create
3) Assign Name for iRule and paste enter irule code into Definition field. Once done press Finished.
4) Go to Local Traffic -> Virtual Servers -> Edit -> iRules – Manage -> select created iRule from a list and press << symbol -> Finished
iRule code
when HTTP_REQUEST { if { [HTTP::host] equals "domain.com" } { HTTP::respond 301 Location "http://www.domain.com" } }