Copied to clipboard

Flag this post as spam?

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


  • stc 72 posts 101 karma points
    May 27, 2010 @ 19:10
    stc
    0

    URL alias reversed...

    ...this might be doable in Umbraco right now, however, I really don't know where to start...on this forum and/or in setup...but I'd like to have a couple of pages that could repeat themselves in each subdirectory on my umbraco content tree.

    In other words, I'd like to make a generic handler page for media items that could take its relative url and then display the media element accordingly...but if I were, lets say on http://mysite.com/subdir1/article.aspx I'd like to have the media element open in http://mysite.com/subdir1/media.aspx?id=1234 (and not have it open in say http://mysite.com/media.aspx?id=1234)... and have the pattern be repeatable in each subdir I might make later on.

    I realize that each time I make a new subdir in the conent tree I could also manually just make a new instance of the generic media handler page (and name it media.aspx there)...but since there's an alias for a page to have it open in a place where it doesn't exist in the content tree...could it be impossible to maybe make this a feature in Umbraco too (I'm guessing the alias thing is done via URLRewriting, but I don't know enough about, so if what I'm proposing is really trivial and could easily be done so that it needn't be a new feature ever, I'd appreciate it then if you could steer me the right way please). TIA

  • Stefan Kip 1614 posts 4131 karma points c-trib
    May 27, 2010 @ 19:29
    Stefan Kip
    1

    You can achieve this using URLRewriting.

    If you're unable to write a regex for all situations you can imagine, you could hook into the Document_New event handler and add a URLRewriting entry in that event handler :)

  • stc 72 posts 101 karma points
    May 28, 2010 @ 13:06
    stc
    0

    Document_New on Folder document type...exactly what I thought of just when I was hitting submit button to post this...however the URLRewriting seems more elegant to me (only I have to learn much more about it, unless there's an example out there already, will start looking/learning now:)

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    May 28, 2010 @ 13:48
    Sebastiaan Janssen
    1

    I've recently discovered the great power of Regular expressions to use in urlrewriting, it's awesome. I use Regexr to help with the regular expressions. In the /config/urlrewriting.config an example is in the comments, also search the forum for some examples that I've posted recently.

Please Sign in or register to post replies

Write your reply to:

Draft