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
    Jul 04, 2012 @ 11:34
    Jan Vermeerbergen
    0

    Need some UrlRewriting assistance...

    I need a bit of help with some UrlRewriting. Basically I need to strip a directory from the URL, but I can't get it to work. 

     

    The URL's look like this: 

    http://www.websitename/realisaties/categoryname1.aspx

    http://www.websitename/realisaties/categoryname/item1.aspx

     

    and the resulting URL's should look like:

    http://www.websitename/categoryname1.aspx

    http://www.websitename/categoryname/item1.aspx

     

    You get the idea. "realisaties" needs to go. 

     

    So far I have what is below, but it doesn't work. I get 404 errors on the pages.

     

    <add name="realisaties" 

    virtualUrl="^~/realisaties/(.*)" 

    rewriteUrlParameter="ExcludeFromClientQueryString" 

    destinationUrl="~/$1" 

    ignoreCase="true" 

    />  

    Does anybody have any insight they would like to share with me? I'm obviously not seeing something...

     

    thanks,

    Jan

  • Mike Chambers 621 posts 1203 karma points c-trib
    Jul 04, 2012 @ 15:33
    Mike Chambers
    0

    Did you touch the web.config or recycle the apppool to get your updated urlrewriting.config looked at?

  • Jan Vermeerbergen 79 posts 112 karma points
    Jul 04, 2012 @ 16:32
    Jan Vermeerbergen
    0

    Yes I did both, but no luck. I'm guessing there's a syntax error somewhere, but can't figure out what ....

  • Mike Chambers 621 posts 1203 karma points c-trib
    Jul 04, 2012 @ 16:35
    Mike Chambers
    0

    http://www.websitename/categoryname/item1.aspx

    do you get a page served if you navigate direct to the destination page?

  • Jan Vermeerbergen 79 posts 112 karma points
    Jul 04, 2012 @ 16:40
    Jan Vermeerbergen
    0

    That returns a 404 page

  • Mike Chambers 621 posts 1203 karma points c-trib
    Jul 04, 2012 @ 17:43
    Mike Chambers
    0

    So that suggests it's not you rul rewriting that is at fault ;-), as the page you are trying to rewrite to is a 404...

  • Jan Vermeerbergen 79 posts 112 karma points
    Jul 04, 2012 @ 17:46
    Jan Vermeerbergen
    0

    Yes I believe I explained myself wrong. 

    I want http://www.websitename/categoryname/item1.aspx to display www.websitename/realisaties/categoryname1.aspx but I don't want it to redirect... 

    I thought of using umbracoUrlAlias but that's not really a viable option since there's over 200 pages already, and the client is adding new ones everyday. Explaining to him he needs to add the umbracoUrlAlias isn't an option...

     

     

  • Mike Chambers 621 posts 1203 karma points c-trib
    Jul 04, 2012 @ 17:49
    Mike Chambers
    0

    so it's the other way round then... but you need something unique in the first url... perhaps category name?

     

    <add name="categoryname" 

    virtualUrl="^~/(categoryname/.*)" 

    rewriteUrlParameter="ExcludeFromClientQueryString" 

    destinationUrl="~/realisaties/$1" 

    ignoreCase="true" 

    />  

    perhaps?

  • 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