Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel.S 50 posts 135 karma points
    Jul 05, 2009 @ 08:44
    Daniel.S
    0

    URL Rewriting - removing .aspx from URL

    Can someone post up their rewrite rule that removes the .aspx from the url? The way it's set up on umbraco.org would be perfect for me.

    I'm about to tear my hair out here. Been trying different rules for about an hour, and have googled all over the place. I'm using Umbraco 4.0.2.1 on IIS7.5 under Windows 7.

    I've set <modules runAllManagedModulesForAllRequests="true"> in my web.config

    I've set umbracoUseDirectoryUrls=true, and have verified that the URL rewrite rules are taking effect. I just keep getting 404s every time I try anything to rewrite /articles into /articles.aspx

    My UrlRewriting.config file currently looks like this:

    <urlrewritingnet  rewriteOnlyVirtualUrls="true"
                      contextItemsPrefix="QueryString"
                      defaultPage = "default.aspx"
                      defaultProvider="RegEx"
                      xmlns="http://www.urlrewriting.net/schemas/config/2006/07" >

      <rewrites>
        <add name="removeaspx"
              virtualUrl="^~/(.*)~"
              rewriteUrlParameter="ExcludeFromClientQueryString"
              destinationUrl="~/$1.aspx"
              ignoreCase="true"
              redirect="Application"
             />

    </urlrewritingnet>

    Thanks,

    Daniel

  • Rasmus Lynggaard 118 posts 325 karma points
    Jul 05, 2009 @ 09:18
    Rasmus Lynggaard
    102

    You don't need rewrite rules to directoryUrls in Umbraco. It's probably because you haven't configured IIS correctly.

    Read my blog post on the subject and see if that doesn't do it

  • Daniel.S 50 posts 135 karma points
    Jul 05, 2009 @ 11:44
    Daniel.S
    0

    Thanks for the quick reply, Rasmus. I won't have the liberty of being able to "configure IIS" like that on the webhost my site will be on once it goes live. From what I've read, there are several ways to skin the URL rewriting cat; the <span style="white-space: pre-wrap; ">runAllManagedModulesForAllRequests="true" method is one of them.</span>

  • Daniel.S 50 posts 135 karma points
    Jul 05, 2009 @ 12:00
    Daniel.S
    0

    You're right, it does work. I guess i'll have to live without this due to the web host though.

  • Paul Blair 466 posts 731 karma points
    Jul 06, 2009 @ 00:07
    Paul Blair
    0

    if your webhost is using IIS7 and you can select integrated pipelines then you don't need access to IIS to configure any values. I have a blog post as well and stpes 4-7 deal with this issue:

    http://blog.fairlieagile.co.nz/2009/5/24/setting-up-a-new-umbraco-project

  • Daniel.S 50 posts 135 karma points
    Jul 06, 2009 @ 00:41
    Daniel.S
    0

    Thanks a heap, Paul. I'll be sure to have a look into that.

  • urvish 9 posts 29 karma points
    Nov 01, 2012 @ 13:09
    urvish
    0

    HI,

    Can anybody give me the demo of Url rewriting....

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft