Forum Discussion
Best way to redirect aprox. 1000 urls
Hi Mary,
you may try the iRule and external data-group below (or at least take a look at it :)...
when HTTP_REQUEST {
if { [set location [class match -value [string tolower "[HTTP::host][HTTP::uri]"] starts_with DG_MyRedirects]] ne "" } then {
HTTP::redirect $location
}
}
External data-group structure:
"input_url" := "target_url",
"publications.mcgill.ca/mcgillnews/2015/10/09/the-myths-around-not-criminally-responsible" := "http://mcgillnews.mcgill.ca/s/1762/news/interior.aspx?sid=1762&gid=2&pgid=572",
"publications.mcgill.ca/somepath" := "http://mcgillnews.mcgill.ca/page.aspx?path=somepath",
"publications.mcgill.ca/somepath/somepath" := "http://mcgillnews.mcgill.ca/page.aspx?path=somepath%2Fsomepath",
Note: The ordering of the data-group does not matter, the
command will always pick the best-matching entry and use the "target_url" data for the redirect. Also keep in mind that the outlined iRule uses a [class]
operator, so that you can redirect every request underneath a given URL structure to the new URL.starts_with
For more information on external data-groups take a look to the
[class] command wiki site.
https://devcentral.f5.com/wiki/iRules.class.ashx
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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