How to Redirect Search Requests to External SmartHub Pages

Scope

This page explains how to configure SharePoint to redirect searches to your SmartHub Results page (hosted outside of SharePoint)

Requirements

  • SmartHub must be accessible from the internet via HTTPS
  • SmartHub must be secured with Azure Active Directory
  • Users must be able to log in to both SharePoint and SmartHub using the same account

Procedure

  1. Create a new site page in your SharePoint main page.
    1. Navigate to your SharePoint environment
    2. Add a new page 



  2. Go to a site collection.

  3. Create a new page.

  4. Add a script editor web part on the new page. 

  5. Edit the script editor snippet.

  6. Add the following scripts:

    <script>if(window.location.search){
    	var smartHubAddress = "https://contoso.smarthub.com/results.html" 
    	var search = window.location.search.replace('?','#');
    	var newSearch = search.replace('k=','ql=');
    	var redirectUrl = smartHubAddress + newSearch
    	location.replace(redirectUrl);
    }
    </script>
  7. Replace the smartHubAddress value with the URL where your SmartHub results page lives.

  8. Follow the steps here to configure this new SharePoint page as your Search Center