Forum Discussion
Dennis_Goss_70_
Nimbostratus
Dec 21, 2015iRule redirect but need some of the original PATH
Relatively new to iRules but have done a ton of scripting (PoSh, vbs, etc...) and understand the basics and have studied the http::uri, http::path and http::query built-in variables - thanks in advan...
Kai_Wilke
MVP
Jan 02, 2016Hi Dennis,
the code looks good. But i duno if you want to have relative redirects based on your website root. If you want a fixed https://* redirect, then take a look to the last line below...
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/oas/ops/programs*" { HTTP::redirect "https://www.mycompany.com[HTTP::uri]" }
Redirects http://* to http://* and https:// to https://*
"/offices/management/ocio/eng/tacticalcommunications*" { HTTP::redirect [string map {"/offices/management/ocio/eng/tacticalcommunications/" "/sites/taccom/"}[HTTP::uri]]}
Redirects http://* and https://* to https://* with -nocase option
"/offices/management/ocio/eng/tacticalcommunications*" { HTTP::redirect "https://www.mycompany.com[string map -nocase {"/offices/management/ocio/eng/tacticalcommunications/" "/sites/taccom/"} [HTTP::uri]]"}
}
}
P.s.: In addition it contains a [string map -nocase] syntax to support case-insensitive deep-links. I guess it would be much more user friendly, isn't it? 😉
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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