Copied to clipboard

Flag this post as spam?

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


  • Steven Wilber 103 posts 98 karma points
    Mar 16, 2010 @ 11:56
    Steven Wilber
    0

    Extensionless flat urls, umbracoUseDirectoryUrls, but not always

    This is not a question, just a useful note for anyone out there.

    I have just resolved a problem that I client has had whilst moving to Umbraco. They had a number of printed publications with "short urls", i.e. 'mydomain.com/downloads' or 'mydomain.com/pha'.

    The reason for them was that on marketing material it is perceived to be more likely that someone will type in 'mydomain.com/offers' rather than 'mydomain.com/products/offers.aspx' or whereever the page might be in the hierarchy.

    The additional requirement was for the client to be able to create new ones themselves so they didn't want to have to adjust the UrlRewriting.config file. 

    At the point I became involved it was too late to look at removing all the .aspx extensions using 'umbracoUseDirectoryUrls' (Google it), so I created an httpModule to check the url against a list of values extracted from actual umbraco content nodes. What I mean to say is that the user can create special 'short link' content nodes that have the match text and either an internal or external link to redirect to. The httpModule then checks the request url against this list and redirects as appropriate.

    I've captured it all in one simple DLL, including an event to flush the cached data on document publication, so if anyone wants a copy, please let me know.

    Cheers

    Steve

  • Petr Snobelt 923 posts 1535 karma points
    Mar 16, 2010 @ 12:05
    Petr Snobelt
    2

    Hi Steve,

    If you configure umbraco to use friendly urls http://our.umbraco.org/wiki/install-and-setup/setting-up-umbraco-for-friendly-urls but leave umbracoUseDirectoryUrls set to false, Umbraco work with both syntax (example.com/about and example.com/about.aspx)

    Petr

  • Steven Wilber 103 posts 98 karma points
    Mar 16, 2010 @ 12:44
    Steven Wilber
    0

    Ha! Thanks for that. I didn't know that at all. Maybe this thread will at least help someone out in the future.

    However all is not in vain as often the pages that are linked are buried deep in the hierarchy and my solution allows for one place where all the shortlinks are defined so it is easier for the client. It does mean however that this could have been implemented with simple XSLT (for external URLs) and umbracoRedirect for internal urls.

    Hey ho! You live and learn. Thanks for the tip.

    Cheers

    Steve

  • Petr Snobelt 923 posts 1535 karma points
    Mar 16, 2010 @ 14:45
    Petr Snobelt
    2

    You also can use UmbracoUrlAlias if you need change hierarchy.

    http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbracourlalias

  • Steven Wilber 103 posts 98 karma points
    Mar 16, 2010 @ 15:03
    Steven Wilber
    0

    Cool, thanks. You have brought this to my attention again. I feel a little like a fool now as I knew these items previously, but have not used them in ages and they had sunk to the back of my mind. Good to have a refresh.

    Cheers

    Steve

Please Sign in or register to post replies

Write your reply to:

Draft