Forum Discussion

veato's avatar
veato
Icon for Nimbostratus rankNimbostratus
Nov 02, 2016

iRule for URL Redirect

I have an on premise SharePoint farm and am migrating to Office 365. As this happens I would like to send requests for the old site to the new. For example the intranet portion of the farm has been migrated so I would like to send:

 

https://mysharepointonprem.company.com/intranet

 

to

 

https://newcloudsharepoint.company.com/sites/intranet

 

Is this something I can do with an iRule? I already have an iApp for the on prem SharePoint farm and it does have a couple of iRules in place already e.g. for https redirect. These will need to remain in place as not all sites have been migrated yet.

 

6 Replies

  • you can try setting up an iRule that looks like this:

     

    when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "/intranet" } { HTTP::redirect "; } }

     

    • veato's avatar
      veato
      Icon for Nimbostratus rankNimbostratus

      Thanks for the suggestion. I've added the iRule (modifying for the correct URLs of course) but no redirect is taking place. I'm simply presented with the current (old) site.

       

    • Kai_M__48813's avatar
      Kai_M__48813
      Icon for Cirrus rankCirrus

      maybe you should replace equals with starts_with, in case the uri is changed.

       

      also, are you placing this iRule on the main virtual server, or a redirect one? and if there are multiple iRules on the virtual server, make sure that the order is correct, so that no iRules above this one will do anything with the traffic so it doesnt get any hits.

       

    • veato's avatar
      veato
      Icon for Nimbostratus rankNimbostratus

      It's on the main Vs and I'm making this the top rule. The below suggestion using starts_with (as you mention above) could be the trick for me!

       

  • Please try this irule.

            when HTTP_REQUEST {
                if { [HTTP::host] equals "mysharepointonprem.company.com" and [HTTP::uri] starts_with "/intranet" } {
                HTTP::redirect "https://newcloudsharepoint.company.com/sites/intranet"
    }
    

    }

    • veato's avatar
      veato
      Icon for Nimbostratus rankNimbostratus

      This looks to be doing what I want so thanks.