Forum Discussion
iRule for redirect - multiple sites to check
Hi
I am looking to implement an iRule on F5 to redirect sites to a new location.
However, I need to able to check at the SharePoint subsite level eg:
https://corpsites.domain.com/it/dr
And then have a switch statement for multiple source sites to redirect to multiple new sites.
Could anyone advise on what an iRule like this would look like?
Thanks
8 Replies
- Brad_Parker
Cirrus
Can you provide a little more detail on what you're trying to accomplish? Input URL and expected redirect location. - Gurdip_Sira_160
Nimbostratus
Hi Brad
The application is SharePoint 2010/2013 (to redirect from) and 2013 to redirect to.
SharePoint URLs for site collections and sites typically look like this:
https://groups.companyname.com/it/SitePages/Home.aspx
So that would be the landing page of a site to redirect from, but users may go direct to a specific page (like /Contacts.aspx), so I need some sort of wildcard to redirect from any page in the site:
I can just redirect to the homepage of the site (which is the same url structure).
So the pseudo code would be:
If (URL is any page under site url) { Redirect to "url")
So something like https://groups.companyname.com/it/SitePages/*.aspx to indicate any page on the source site.
Thanks
- IheartF5_45022
Nacreous
Is the 'from' hostname (domain) relevant? Or only the path? The following code ;-
if {[HTTP::path] starts_with "/it/Sitepages" } { HTTP::respond "https://[HTTP::host]/[URI::basename [HTTP::uri]]" }would redirect from;-
https://groups.companyname.com/it/SitePages/Home.aspxto;-
https://groups.companyname.com/Home.aspx- Gurdip_Sira_160
Nimbostratus
Hi, That still redirects to the same site/domain name. The "to" should be a completely different domain ie groups2.companyname.com/it/SitePages/Home.aspx How would the syntax look if this is a multiple if/else statement?
- Brad_Parker
Cirrus
Sounds pretty straight forward. Give this a try:
when HTTP_REQUEST { if {[HTTP::path] starts_with "/it/Sitepages" } { HTTP::respond 301 noserver "https://groups2.companyname.com[HTTP::uri]" } }- Gurdip_Sira_160
Nimbostratus
Thanks! I will try this tomorrow but it looks like what I need, from a psuedo code and syntax perspective.
- Brad_Parker_139
Nacreous
Sounds pretty straight forward. Give this a try:
when HTTP_REQUEST { if {[HTTP::path] starts_with "/it/Sitepages" } { HTTP::respond 301 noserver "https://groups2.companyname.com[HTTP::uri]" } }- Gurdip_Sira_160
Nimbostratus
Thanks! I will try this tomorrow but it looks like what I need, from a psuedo code and syntax perspective.
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