How to remove something (the port) from the URL as returned in the search results (searchresults.aspx):

How to remove something (the port) from the URL as returned in the search results (searchresults.aspx):


UPDATE : the behavior depicted below should not happen after installing October 2009 Cumulative Update package:


Download October 2009 Server-Package for WSS (974989)

Download October 2009 Server-Package for MOSS 2007 (974988)

If you have not upgraded or need a workaround, read on:

Starting with the Infrastructure update, the following behavior can be encountered when searching for people:

The port (usually 80) is appended to the URL of the location for each result, resulting in error for all the internet facing personal sites.

For example, imagine you published your my site location in Alternate Access Mappings at : to be accessed from the intranet and  to be accessed from the internet.


When you are searching for a user when logged on from the internet side of things, you will receive the results pointing to which will throw an error upon accessing (page not found).


If you want to overcome the issue (eg, you are looking for a quick fix) here's what you can do:

Go to your search center with tabs and search for something, just to get to the people results page.

Edit the page and modify the People Search Core Results web-part.

Click on the XSL Editor button to get to the XSL style sheet applied to the resultset.

The URL for each result is under the following section:

<!-- This template is called for each result -->

<xsl:template match="All_Results/Result">

<xsl:variable name="id" select="id"/>


here ,


replace <xsl:variable name ="url" select ="url"/> line with:

<xsl:variable name ="temp" select ="url"/> <!-- We put the url value from the resultset in temp variable -->

            <xsl:variable name="url"> <!-- This will be the value used in the xsl from now on in this section as $url -->


                        <xsl:when test="contains($temp,':80')"> <!--We check temp variable for the occurrences of string :80-->

                        <xsl:value-of select ="concat(substring-before($temp,':80'),substring-after($temp,':80'))"/>

                                    <!--We remove from temp variable the occurrences of string :80-->



            <xsl:value-of select ="$temp"/> <!--If we did not find the :80 we will retain the default value (url) as defined above-->






So from now on, wherever we will use $url we will have the translated version of the url returned in the resultset

eg. for the result would be

Of course you will also need to play with the Search High Confidence Results web Part to Edit it accordingly.

The place where you need to replace the url is :


<xsl:template match="All_Results/HighConfidenceResults/Result">

<xsl:if test="$DisplayHC = 'True' and $IsFirstPage = 'True'" >

<xsl:variable name="prefix">IMNRC('</xsl:variable>

<xsl:variable name="suffix">')</xsl:variable>

<xsl:variable name="url" select="url"/>

<xsl:variable name="id" select="id"/>

replace <xsl:variable name ="url" select ="url"/> line as above

Here are some additional references on how to edit, and tune the search results to fit your company needs: