Try Now
More in this section

Forums / Developing with Sitefinity / How to achieve Url Rewriting/Redirection

How to achieve Url Rewriting/Redirection

3 posts, 0 answered
  1. Surya CD
    Surya CD avatar
    57 posts
    06 Apr 2010
    19 May 2012
    Link to this post

    Hi All,
    I need to rewrite/redirect urls for my Sitefinity 5 website to these formats.

    1. http://test.net/default.aspx to http://test.net/en/default

    2. http://test.net/en/default.aspx to http://test.net/en/efault

    The site should support multiple languages.
    If the language selected is Chinese, the url for home page will be 

    3. http://test.net/zh-CHS/default-zh.aspx to http://test.net/zh-CHS/default-zh

    4. http://test.net/default-zh.aspx to http://test.net/zh-CHS/default-zh

    I am trying to rewrite/redirect these using urlrewriter.net. 
    But I don't know the regular expressions to achieve this. Please help.


  2. MB
    MB avatar
    302 posts
    09 Jan 2005
    21 May 2012
    Link to this post
    A good reference is here.


    Obviously, it helps if you already understand regular expressions, but the 'Match URL' section on IIS7.5 has a pattern-match test function, so you can trial and error your patterns against real URL examples, and get the {R:n} references for URL manipulation. 

    By default, the rewrite match expects to only test path and query, not the scheme and host.
  3. Brett Whittington
    Brett Whittington avatar
    89 posts
    10 Aug 2012
    01 Jun 2012
    Link to this post
    So I believe you are using the URL rewriter from http://urlrewriter.net/.  To remove the .aspx, I had to add the following section to my web.config.  It basically takes whatever the URL is and strips the .aspx off of it.
        <redirect url="~/(.+)\.aspx" to="~/$1" />        
3 posts, 0 answered