Forum Discussion
Puneet_73909
Nimbostratus
May 11, 2009Redirection iRule
Hi,
I need help in writing an iRule. I want to read domain name and then redirect it to specific URL.
For example if HHTP::request is for www.domain.com then it will redirect it to www.abc.com and if request is for www1.domain.com then it will redirect it to www.xxyz.com.
In addition to this if request is for http://www.DomainName.com/doc redirects to http://www.DomainName.com/ecom/pages/nm/nmhomepage.jsp and same goes for
http://www1.DomainName.com/minisite redirects to http://www1.DomainName.com/ecom/pages/nm/nmhomepage.jsp
All requests to http://www.joinDomainName.com gets forwarded to http://www.joinDomainName.com and http://www1.joinDomainName.com gets forwarded to http://www1.joinDomainName.com
Please help!!
Regards,
Puneet Khanna
4 Replies
Sort By
- The_Bhattman
Nimbostratus
Hi Puneet,when HTTP_REQUEST { set h [HTTP::host] set u [HTTP::uri] switch -glob $h { "www.domain.com" { HTTP::redirect "http://www.abc.com" } "www1.domain.com" { HTTP::redirect "http://www.xxyz.com" } "www.domainname.com" - "www1.domainname.com" { switch -glob $u { "/doc" - "/minisite" { HTTP::redirect "http://[HTTP::host]/econ/pages/nm/nmhomepage.jsp" } } } } }
- Puneet_73909
Nimbostratus
Thnx CB.. - The_Bhattman
Nimbostratus
I think it will work. But I am not sure if this is the most efficient way to have request run through - Puneet_73909
Nimbostratus
CM you are right!!!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects