How to get absolute URL when using Html.CanonicalLink() for Google search

  • Updated
Description

Some customers asked how to get absolute URL when using Html.CanonicalLink() for Google search, such as @Html.CanonicalLink(UrlHelpers.BuildCanonicalUrl(Model.CurrentPage), System.Globalization.CultureInfo.CurrentCulture.Name, "")

Steps

If the host specified in the current request matches the primary host defined in the site definitions, then it functions correctly. You can set the host referring https://support.optimizely.com/hc/en-us/articles/4413192303629-Websites.