Extensionless Urls in Sitefinity5.0

Posted by Community Admin on 03-Aug-2018 06:57

Extensionless Urls in Sitefinity5.0

All Replies

Posted by Community Admin on 30-Apr-2012 00:00
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:
' 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
Posted by Community Admin on 30-Apr-2012 00:00
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!
This thread is closed