0

I have renamed the enterprise search center url from /xxxxx/Search to /xxxxx/WebSearch

Search from root site top navigation search dropdown takes to https://xxxxx/WebSearch, which is good. But search from any subsite takes it to https://xxxxx/Search and we get page not found error. How to fix this without going to each subsite and doing any changes, because we have a lot of subsites in the site collection.

3 Answers 3

1

Check your Search Service Application. There is a setting for the Global Search Center URL. It is likely pointing to the old location.

0

I think if your sub-site settings are set to inherit from Parent then it will automatically update it. Another way is use the powershell to update for all at once.

function SetSearchSettingsSite($siteUrl,$searchCenterUrl,$resultPagesUrl)
{
 $site = Get-SPSite $siteUrl
 $site.AllWebs | ForEach-Object {
 $web = $_
 $web.AllProperties["SRCH_SB_SET_WEB"] = '{"Inherit":false,"ResultsPageAddress":"'+$resultPagesUrl+'","ShowNavigation":false}'
 $web.AllProperties["SRCH_ENH_FTR_URL_WEB"] = $searchCenterUrl
 $web.Update()
 }
}

Read more about above code here: Update Search Settings using Powershell in SharePoint 2013

Also check this one http://sharepoint.jsturges.com/2012/02/update-search-center-for-all-sites-in-a-web-application/

1
  • Thanks. Subsites are already inheriting from parent. I disabled and enabled inheritting manually for a subsite, it didnt work. I can try the script in the links.
    – Venkat
    Jul 22, 2016 at 14:06
0

This worked.

$spSitecollection="https://xxxx.com"
$webs= get-spsite $spSitecollection | Get-SPWeb -Limit all | where {$_.serverrelativeurl -ne "/xxxSearch"} | select serverrelativeurl


foreach ($element in $webs) {
       $relURL="$spSitecollection$($element.serverrelativeurl)"
       $web=get-spweb $relURL
       $web
    #delete existing link
    $navItems=@();
       $navs = $web.Navigation.SearchNav
       foreach ($nav in $navs)
       {
             $nodeid =$web.Navigation.GetNodeById($nav.Id)
             $navItems+=$nodeid
             write-host "$($nodeid.title) add id $($nodeid.Id) to array"  
       }   
       foreach ($node in $navItems)
       {
             $web.Navigation.SearchNav.delete($node)
             write-host "delete id $($node.Id)"    
       }     
       $web.update()       
$titleTHISSITE="This Site"
       $relativeURLTHISSITE=$element.serverrelativeurl + "/_layouts/15/osssearchresults.aspx?u=$($relURL)"
       $nodeTHISSITE=new-object -TypeName "Microsoft.SharePoint.Navigation.SPNavigationNode" -ArgumentList $TitleTHISSITE, $RelativeUrlTHISSITE, $true 
       $web.Navigation.SearchNav.AddAsLast($nodeTHISSITE)
       $titleEVERYTHING="Everything"
       $relativeURLEVERYTHING=$serverrelativeurl + "/xxxSearch/Pages/results.aspx"
       $nodeEVERYTHING=new-object -TypeName "Microsoft.SharePoint.Navigation.SPNavigationNode" -ArgumentList $TitleEVERYTHING, $RelativeUrlEVERYTHING, $true 
       $web.Navigation.SearchNav.AddAsLast($nodeEVERYTHING) 

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.