Copied to clipboard

Flag this post as spam?

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


  • Jan Vermeerbergen 79 posts 112 karma points
    Jan 23, 2012 @ 16:08
    Jan Vermeerbergen
    0

    simple urlrewrite turns out to be not so simple...

    Hi guys,
    for a project I need to implement an urlrewrite that rewrites all pages in a specific directory like this:
    for example www.example.com/categories/page1 needs to become www.example.com/page1

    I've tried a million different things, but I just can't get it to work.

    Can anybody point me in the right direction on how to achieve this in the urlrewrite config?

    thanks a lot!

    Jan

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jan 23, 2012 @ 16:29
    Stefan Kip
    0

    Use this regex with the UrlRewriting.NET plugin (which is included with umbraco) or the IIS UrlRewrite module: categories/(.+)
    The first group is the match, so redirect/rewrite to (IIS UrlRewrite module syntax): /{R:1} 

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jan 23, 2012 @ 16:30
    Stefan Kip
    0

    And I think this should do it with the UrlRewriting.NET plugin:

    <add name="CategoriesRewrite"
    virtualUrl="^~/categories/(.+)"
    rewriteUrlParameter="ExcludeFromClientQueryString"
    destinationUrl="~/$1"
    ignoreCase="true" />
  • Jan Vermeerbergen 79 posts 112 karma points
    Jan 23, 2012 @ 16:40
    Jan Vermeerbergen
    0

    @kipusoep: Thanks for your reply. 

    I added the categoriesrewrite to my urlrewrite config file, but then the pages return a 404 error. 

    Can you explain your first post a little bit more please? IIS isn't exactly my level of expertise...

    thanks!

    J

  • Jan Vermeerbergen 79 posts 112 karma points
    Jan 26, 2012 @ 11:22
    Jan Vermeerbergen
    0

    any follow up on this?

Please Sign in or register to post replies

Write your reply to:

Draft