.html page extension on every sitecore pages

I want to decorate every sitecore page with .html file extension Ex: mysite/abc.html

How i can do that in Sitecore web development or how to handle it in sitecore?



Prem Murmu




  • Hi Prem,

    You can change page extension by overriding the HttpRequestBegin pipeline.

    Please check the implementation at sitecoreblog.patelyogesh.in/.../sitecore-friendly-url-remove-change-extension.html
  • Prem,

    I think just adding html in allowed extensions setting in Sitecore.config will work for you -

    <processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
    <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx, html</param>
    <param desc="Blocked extensions (comma separated)">*</param>
    <param desc="Blocked extensions that stream files (comma separated)">*</param>
    <param desc="Blocked extensions that do not stream files (comma separated)">

    Also for making the same update in all the links of site you need customize LinkProvider as below -

    make addAspxExtension to true so that we can replace it by our desired extension -

    protected static new LinkBuilder CreateLinkBuilder(Sitecore.Links.UrlOptions options)
    return new LinkBuilder(options);

    public override string GetItemUrl(Item item, UrlOptions options)
    string itemUrl = base.CreateLinkBuilder(options).GetItemUrl(item);
    if (this.LowercaseUrls)
    itemUrl = itemUrl.ToLowerInvariant();
    return itemUrl.Replace(".aspx", ".html");