Forum Discussion

Channafc_199743's avatar
Channafc_199743
Icon for Nimbostratus rankNimbostratus
Nov 14, 2017

Is it possible to to do a HTTP redirect via URI and have anything after the / rediect as well?

for example if a user clicks on a document located at "; I need the iRules to redirect it but need it to be based almost like a wildcard /*.

    when HTTP_REQUEST {
        if { [HTTP::host] equals "old.sharepoint.net" and [HTTP::uri] equals "/sites/migrationtesting/" } {
            HTTP::redirect "https://new.sharepoint.com/sites/migrationtesting/"
            }

1 Reply

  • I think I understand your request.

    If you are just changing the host that the content is served from, but the URI is the same, this iRule should do what you need:

      when HTTP_REQUEST {
        set oldSite "old.sharepoint.net"
        set newSite "new.sharepoint.com"
        set testUri "/sites/migrationtesting/"
    
        if {([HTTP::host] equals $oldSite) and ([HTTP::uri] starts_with $testUri)} {
            HTTP::redirect "https://$newSite[HTTP::uri]"
        }
    
    }