Copied to clipboard

Flag this post as spam?

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


  • kylepauljohnson 70 posts 108 karma points
    Sep 02, 2009 @ 19:24
    kylepauljohnson
    0

    Rewrite Seems to Redirect Instead?

    Good morning, I am trying to setup urlrewriting on Tim Geyssen's blog package.  Essentially I want to redirect the URL away from the date based URL and make it a more simple format like /blog/postname.aspx.  A more specific example is below.

    /blogtest/2009/9/1/test-post---welcome.aspx

    to...

    /blogtest/test-post---welcome.aspx

    I am using the config/UrlRewriting.config file to enter the rules and it seems to be trying to do this rewrite, but it seem like maybe it's trying to do a redirect instead.  Here is the rule I am using...

    <add name="blogRewrite" redirectMode="Permanent" virtualUrl="^~/blogtest/..../..?/..?/(.*).aspx" destinationUrl="~/myblog/$1.aspx" ignoreCase="true" />

    and here is the response I get when I test this.  Thoughts?  Help?

    ---------------------------------------------------------------------------------

    Page not found

    No umbraco document matches the url 'http://kylepauljohnson.com/myblog/test-post---welcome.aspx'

    umbraco tried this to match it using this xpath query'/root/node/node [@urlName = "myblog"]/node [@urlName = "test-post---welcome"] | /root/node [@urlName = "test-post---welcome"]')

    This page can be replaced with a custom 404 page by adding the id of the umbraco document to show as 404 page in the /config/umbracoSettings.config file. Just add the id to the '/settings/content/errors/error404' element.

    For more information, visit information about custom 404 on the umbraco website.

    This page is intentionally left ugly ;-)

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 02, 2009 @ 20:21
    Dirk De Grave
    0

    Mmm, the most obvious question first... Do you have a /myblog page? You seem to redirecting to that one, but might think you want to redirect to /blogtest instead of /myblog?

     

    /Dirk

  • bob baty-barr 1180 posts 1294 karma points MVP
    Sep 02, 2009 @ 20:40
    bob baty-barr
    0

    hmm... i am kinda curious about this one too... i tried updating the rule above, but also got 404...hmmm

  • kylepauljohnson 70 posts 108 karma points
    Sep 02, 2009 @ 20:41
    kylepauljohnson
    0

    So maybe my "greenness" comes out here.  But shouldn't the URLRewrite simply mask the page that is there?  So essentially the origianl page is loaded but with the alternate alias?

    I am not looking to redirect so much as just give it a friendlier URL.  i.e. remove the date folder levels.

  • bob baty-barr 1180 posts 1294 karma points MVP
    Sep 02, 2009 @ 21:11
    bob baty-barr
    0

    you can use umbracoUrlAlias to achieve the alterate url you are speaking of... have a text field on the blogpost docType and you can specify anything for that alias.

    however, i am interested in shortening the url by removing the date folder, so interested to hear what more experienced devs hav to say.

  • kylepauljohnson 70 posts 108 karma points
    Sep 02, 2009 @ 21:32
    kylepauljohnson
    0

    @bob baty-barr Right, I did look into this method and did get it to work sucessfully, however I was hoping for a more automated approach, thus the URLrewriting.

    I don't mind the folder organization in the CMS itself, I would just like it organized more cleanly for the visitors.

  • bob baty-barr 1180 posts 1294 karma points MVP
    Sep 02, 2009 @ 21:38
    bob baty-barr
    0

    @kylepauljohnson... exactly... i am hoping someone can point us in the right direction with urlrewriting... i have only created very basic rules and am not very familiar with how to address this challenge.

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Sep 02, 2009 @ 21:57
    Peter Dijksterhuis
    0

    I think you have 2 options here:

    First: do you need the folder organization in the backend? If no, then you can alter the blogpackage to not use the folders. Which will automatically result in the URL's you want. (But, you get a lot of content in 1 folder if you get a lot of blogposts).

    Second: Again, alter the blogpackage so that the nice-URL gets created automagically when you create a new post.

    I think the second one is the easiest to accomplish. Maybe other have some other ideas though.

    HTH,

    Peter

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 02, 2009 @ 21:58
    Dirk De Grave
    0

    Hi,

    AFAIK, url rewriting won't help here. As Bob pointed out, umbracoUrlAlias is a viable solution, which essentially is the same as writing a not found handler for your installation. Such a handler kicks in whenever no matching page can be found.

    If you want to have the umbracoUrlAlias populated for each new blog post, I'd suggest to write up an event handler that checks that fires on document creation and set the property value accordingly.

    Have a look at the event samples available on the wiki

     

    Cheers,

    /Dirk

  • 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