London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
UrlBuilder url = new UrlBuilder(page.LinkURL);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, page.PageLink, System.Text.UTF8Encoding.UTF8);
// url now contains the rewritten URL
Note that the second parameter (page.PageLink) is not necessary, passing null will deduce the PageReference from the url, but if it is known you will gain some perf by passing it.
You should also take a look at the GetHtmlRewriter method on UrlRewriteProvider. This will rewrite an entire HTML chunk with friendly url conversion and rebasing, which may be closer to what you need.
Best Regards, Magnus Stråle