Forum Discussion
baboo1970
Altostratus
Nov 03, 2019Irule Datagroup redirect
I have following URLs that need to be redirected using Datagroup and irule but i can't figure out the irule or data set https://www.abc.ca/marrow/Overview > https://test.abc.ca/stashtest ht...
Nov 03, 2019
Hi Jawed,
Data-group:
ltm data-group internal test {
records {
www.abc.ca/marrow/BewardsProductList\?a=true&selectedCategoryId=cat70001 {
data xyz.ca/merks
}
www.abc.ca/marrow/Overview {
data test.abc.ca/stashtest
}
www.abc.ca/marrow/Sponsors {
data xyz.ca.ca/stashbwards/list
}
www.abc.ca/marrow/SponsorsDetails\?Nr=vendor.id:100218 {
data xyz.ca.ca/stashrbwards/touterer/88991
}
www.abc.ca/marrow/SponsorsDetails\?Nr=vendor.id:100245 {
data xyz.ca.ca/stashrbwards/boucher/89021
}
www.abc.ca/marrow/Sponsors\?N=105098 {
data xyz.ca.ca/stashbwards/list\?stash_bward_filter=boucherstore
}
www.abc.ca/marrow/Sponsors\?N=105099 {
data xyz.ca.ca/stashrewards/list\?stash_bward_filter=in-store
}
abc.ca/marrow/BewardsProductList\?a=true&selectedCategoryId=cat70001 {
data xyz.ca/merks
}
abc.ca/marrow/Overview {
data test.abc.ca/stashtest
}
abc.ca/marrow/Sponsors {
data xyz.ca.ca/stashbwards/list
}
abc.ca/marrow/SponsorsDetails\?Nr=vendor.id:100218 {
data xyz.ca.ca/stashrbwards/touterer/88991
}
abc.ca/marrow/SponsorsDetails\?Nr=vendor.id:100245 {
data xyz.ca.ca/stashrbwards/boucher/89021
}
abc.ca/marrow/Sponsors\?N=105098 {
data xyz.ca.ca/stashbwards/list\?stash_bward_filter=boucherstore
}
abc.ca/marrow/Sponsors\?N=105099 {
data xyz.ca.ca/stashrewards/list\?stash_bward_filter=in-store
}
}
type string
}
iRule:
when HTTP_REQUEST {
if { [class match [HTTP::host][HTTP::uri] equals test1] } {
set redirect_value [class match -value [HTTP::host][HTTP::uri] equals test1]
HTTP::respond 301 Location "https://$redirect_value"
}
}
If you want to use without datagroup:
when HTTP_REQUEST {
if { [HTTP::host] equals "www.abc.ca" || [HTTP::host] equals "abc.ca" } {
switch -glob [string tolower [HTTP::uri]] {
"/marrow/overview/" { HTTP::respond 301 Location "https://test.abc.ca/stashtest" }
"/marrow/sponsors" { HTTP::respond 301 Location "https://xyz.ca.ca/stashbwards/list" }
"/marrow/sponsors?n=105098" { HTTP::respond 301 Location "https://xyz.ca.ca/stashbwards/list?stash_bward_filter=boucher" }
"/marrow/sponsors?n=105099" { HTTP::respond 301 Location "https://xyz.ca.ca/stashrewards/list?stash_bward_filter=in-store" }
"/marrow/sponsorsdetails?nr=vendor.id:100218" { HTTP::respond 301 Location "https://xyz.ca.ca/stashrbwards/touterer/88991" }
"/marrow/sponsorsdetails?nr=vendor.id:100245" { HTTP::respond 301 Location "https://xyz.ca.ca/stashrbwards/touterer/89021" }
"/bewardsproductlist?a=true&selectedcategoryid=cat70001" { HTTP::respond 301 Location "https://xyz.ca/merks" }
}
}
}
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