Forum Discussion

joeinbuffalo's avatar
joeinbuffalo
Icon for Nimbostratus rankNimbostratus
Nov 07, 2023

iRule for migrating to Sharepoint Online

Hello, 

I'm very new to the F5 platform and creating iRules.  I did try searching the forums, and there is a lot of good information (thank you contributors), but can't find a solution to exactly what I need to do. 

We are migrating off an on-premise Sharepoint to Sharepoint Online/365.   I would like to have an iRule that states:

If you are going to myportal.company.com then redirect to sharepointonline.company.com but if there is anything after the URI then redirect to sharepointonline.company.com/sites/<URI>

For example:

myportal.company.com = sharepointonline.company.com
myportal.company.com/hr = sharepointonline.company.com/sites/hr
myportal.company.com/aa = sharepointonline.company.com/sites/aa

I was hoping not to have to list out every URI, but I didn't know if I could use a wildcard.   Any help or pointers would be appreciated  

  • Hi joeinbuffalo,

    when HTTP_REQUEST {
      if { [HTTP::host] eq "myportal.company.com" } {
        if { [HTTP::uri] eq "/" } {
          HTTP::redirect "https://sharepointonline.company.com"
          return
        }
        else {
          HTTP::redirect "https://sharepointonline.company.com/sites[HTTP::uri]"
          return
        }
      }
    }
  • Hi joeinbuffalo,

    when HTTP_REQUEST {
      if { [HTTP::host] eq "myportal.company.com" } {
        if { [HTTP::uri] eq "/" } {
          HTTP::redirect "https://sharepointonline.company.com"
          return
        }
        else {
          HTTP::redirect "https://sharepointonline.company.com/sites[HTTP::uri]"
          return
        }
      }
    }
    • joeinbuffalo's avatar
      joeinbuffalo
      Icon for Nimbostratus rankNimbostratus

      Hello Enes_Afsin_Al

      This worked perfectly!  I truly appreciate your time and expertise in assisting me.    

      Thank you!

      Joe

      • LiefZimmerman's avatar
        LiefZimmerman
        Icon for Admin rankAdmin

        Right out of the gate you got the word direct from one of our MVPs! Great well-formed question. Quick easy answer.
        Nice.
        Thanks Enes_Afsin_Al 

        Welcome to the DevCentral community joeinbuffalo!