Notes how to develop against EPiServer friendly URLs.
Snipplet to create a minimal Friendly URL handlerSpy on the Friendly URLs output streamSimple address to page – a functionality to create short cuts (e.g. /My-best-news) to pages
Create a friendly URL for external use
UrlBuilder ub = new UrlBuilder(url);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(
ub,
pageLink,
System.Text.UTF8Encoding.UTF8);
string url = url.Uri.OriginalString;
Remarks: Converting URL to friendly URLs should only be done when an external source should access the page (such as java script, AJAX, web request and so on). NEVER when writing URLs to parse able HTML – then the site mists its possibility to disable friendly URLS.
Disable friendly URLs
Out comment the UrlRewriterModule
<configuration>
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="EPiServer.Web.UrlRewriteModule, EPiServer" />
to
<!--<add name="UrlRewriteModule"
type="EPiServer.Web.UrlRewriteModule, EPiServer" />-->
Out comment the UrlRewriterModule
Disable url rewriting for specific URL
FriendlyUrlRewriteProvider.UnTouchedPaths.Add("/folder/mypage.aspx");
or for EPiServer CMS6:
EPiServer.Web.FriendlyUrlRewriteProvider.AddExcludedPath("/folder/mypage.aspx");
External Links
EPiServer devleores guide for Friendly URLs