1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Extensionless Urls in Sitefinity5.0

Extensionless Urls in Sitefinity5.0

2 posts, 0 answered
  1. Vaiga
    Vaiga avatar
    26 posts
    Registered:
    27 Feb 2012
    30 Apr 2012
    Link to this post
    Hi All,

           Can any one give me a good idea about url without extensions in sitefinity ie i want to access a page with out entering the .aspx extension.Am using sitefinity5.0

    Example:
    ' http://localhost:1900/Default.aspx '   This is the actual url.I want to access the same page by entering url like this ' http://localhost:1900/Default ' .

    Thanks,
    Vaiga
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    30 Apr 2012
    Link to this post
    Vaiga,

    By default, all urls for pages created in Sitefinity are created without any extension. are you by any chance migrating from Sitefinity 3.7? these urls are transferred including the extension

    However you can remove page extensions from Sitefinity with the following sample code:

    using (var api = App.WorkWith()){
        var pages = api.Pages().LocatedIn(PageLocation.Frontend).ThatArePublished()
            .ForEach(page =>
            {
                page.Extension = null;
            }).SaveChanges();
    }

    hope this is helpful!
2 posts, 0 answered