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

Forums / Developing with Sitefinity / How use SEO URLs (without extensions *.aspx)?

How use SEO URLs (without extensions *.aspx)?

4 posts, 0 answered
  1. Anton Mernov
    Anton Mernov avatar
    110 posts
    Registered:
    03 Dec 2008
    05 Dec 2008
    Link to this post
    Hi,

    How I can do URL without extensions, for example:
    http://myhost/products/car/
    http://myhost/news/12-12-08/

    What I can do to handle URLs and replace *.aspx ?

    Thanks,
    Anton.

  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    05 Dec 2008
    Link to this post
    Hi Anton,

    Thank you for using our service.

    There are two possible ways to implement extensionless URLs. You can read
    Wildcard Application Mappings and Extensionless URLs topics in the Sitefinity User Guide (you can find it at http://www.sitefinity.com/documents/UserManual_3_5.pdf).


    Extensionless URLs topic is the preffered method to use:

    Problem when not specifing extension for URL is that IIS server cannot understand that URL is actually *.aspx page. Proposed solution in Extensionless URLs topic is based on handling of 404 HTTP Status error occurring when you request URL without extension (you must follow the instructions from User Manual for Extensionless URLs topic.

    In the aspx page (named sf404.aspx in Extensionless URLs topic) handling error redirect to actual aspx page:

    using System;  
    using System.Collections.Generic;  
    using System.Web;  
    using System.Web.UI;  
    using System.Web.UI.WebControls;  
     
    public partial class sf404 : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            string baseUrl = Request.Url.AbsolutePath + ".aspx" ;  
            Response.Redirect(string.Format( "{0}?{1}", baseUrl, Request.Url.Query);  
        }  
    }  
     

    Let us know if this helps you.

    Greetings,

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Anton Mernov
    Anton Mernov avatar
    110 posts
    Registered:
    03 Dec 2008
    05 Dec 2008
    Link to this post
    Thanks for answer!

    But first, I want replace all *.aspx extensions in output html page to "/"
    How I can do this? maybe using web.config and attributes urlRewriteFormat?

    Best regards,
    Anton.

  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    08 Dec 2008
    Link to this post
    Hello Anton,

    The method we provide you with will work also for your existing pages, in case they are created with Sitefinity.

    If you want to change the way how the links are rendered on the page, yes, you can try to do that with the UrlRewriteFormat for each module. We haven't tested that though.

    Let me know if I am missing something.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered