What version and build of Sitecore are you using?
I just looked at Sitecore.Links.LinkProvider in Sitecore.Kernel , and the BuildItemUrl method replaces the encodeNameReplacements characters with part of the URL path, so it must leave its hostname on its own.
I would expect the same thing to happen and vice versa, and by looking at Sitecore.Pipelines.HttpRequest.SiteResolver , the SiteContext will be resolved by matching the requested Uri to specific sites. Next, the Sitecore.Pipelines.HttpRequest.ItemResolver process decodes Item Url, but the site has already been resolved at this point.
hostName you set the hostName attribute for <site> elements? Have you tried setting the targetHostName attribute? You tried to set multiple host names, I do not expect it to work with spaces, but it is worth a try if you are telling the truth:
<site name="website" hostName="my-site.com|my site.com" ... />
I tried to replicate your problem on my local computer, but it worked as expected for me ... If you are not working with very strange character sets, this, in my opinion, is still the best way to encode names.
jammykam
source share