Rewriting Links In Search Results (XSLT)

Occasionly you may find that you want to build your own link translation functions directly into the search XSLT, essentially stating two parameters, the URL attributes to find, and the URL attributes to replace it to, adjusting the return on the SharePoint search results page.

This is not difficult to do, and can simply be done in your XML available in the WebPart properties in your Search Results WebPart. In the below, you can see that the two previously talked about variables are the same URL, however the prefix to is simply being adjusted to the SSL enabled site. Not a very clever example, however accurately solves the problem.


Once you have this in your XSLT, you can use the rewritten_url variable to do whatever you want!