Copied to clipboard

Flag this post as spam?

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


  • Andrea Orimoto 16 posts 34 karma points
    Oct 22, 2009 @ 17:01
    Andrea Orimoto
    0

    How to configure url rewrite when umbracoUseDirectoryUrls is set to true

    Hello everybody,

    I've searched everywhere but I can't figure it out... The explanation on this wiki link

    http://our.umbraco.org/wiki/reference/packaging/package-actions/community-made-package-actions/add-an-url-rewrite-rule

    works if pages are using the .aspx extension, but if you have set umbracoUseDirectoryUrls to true this doesn't work anymore.

    I would be grateful if somebody could give some step by step explanation or point me to some already written resource.

    The urlrewrite documentation http://www.urlrewriting.net/160/en/documentation.html suggests to add the defaultPage setting in the config. I tried various combinations of the following, changing/removing the defaultPage and tampering with the destinationUrl:

    <urlrewritingnet defaultPage="default.aspx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
     <rewrites>
      <add name="archivePagingRewrite"
       virtualUrl="^~/archive/page/(.*)"
       rewriteUrlParameter="ExcludeFromClientQueryString"
       destinationUrl="~/archive/default.aspx?page=$1"
       ignoreCase="true" />


     </rewrites>
    </urlrewritingnet>

    Adding the defaultPage="default.aspx" breaks everything. All urls will come up with a /default.aspx appended. Not adding it, will have no effect on the urls I want to rewrite.

    The goal is to rewrite a url like http://mysite.com/foo/bar/archive?page=3 to http://mysite.com/foo/bar/archive/page/3

    I found this old forum post http://forum.umbraco.org/yaf_postst5203_Recreate-a-more-natural-URL-structure.aspx in which imayat12 describes he did exactly what I need to do, but not how!

    Is begging allowed in this Forum? :)

    Thanks

    Andrea

  • Andrea Orimoto 16 posts 34 karma points
    Oct 29, 2009 @ 03:26
    Andrea Orimoto
    0

    Hello, anybody any idea?

    thanks

    Andrea

  • Andrea Orimoto 16 posts 34 karma points
    Oct 29, 2009 @ 10:57
    Andrea Orimoto
    0

    Solved... it was easier than I thought, the UrlRewrite document is a little bit misleading...

    Anyway, no "defaultPage" page setting is needed in the config. The example in my original post has been solved like the following

    <urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
     
    <rewrites>
     
    <add name="archivePagingRewrite"
       
    virtualUrl="^~/foo/bar/archive/page/(.*)"
       
    rewriteUrlParameter="ExcludeFromClientQueryString"
       
    destinationUrl="~/foo/bar/archive.aspx?page=$1"
       ignoreCase="true" />


     
    </rewrites>
    </urlrewritingnet>
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies