Forum Discussion
Best way to redirect aprox. 1000 urls
We are using F5 10050 version 11.6.1 Build 0.0.317
I need to redirect about 1000 urls using an iRule. I have never done this but after reading some data, I see that we can do it via a Data Group List. How would I go about this by setting up a text file with all the redirects.
An example of one of the urls that I need to redirect:
From: http://publications.mcgill.ca/mcgillnews/2015/10/09/the-myths-around-not-criminally-responsible/ To: http://mcgillnews.mcgill.ca/s/1762/news/interior.aspx?sid=1762&gid=2&pgid=572
Greatly appreciate any help! Thank you Mary Paseli
2 Replies
- jgranieri
Nimbostratus
You can also use HTTP Local Policies which are basically irules. I hope you can use some wildcards in the URL's to limit the . I am not sure you can have 1000 rules in a HTTP policy for URL redirection. With such a large you might need to consider data-groups and or referencing an external file with an irule.
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_withFor more information on external data-groups take a look to the
command wiki site.[class]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