Copied to clipboard

Flag this post as spam?

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


  • Angelo 20 posts 72 karma points
    Aug 24, 2012 @ 23:21
    Angelo
    0

    Shortening the URLs

    Dur to our content structure, our urls are like this:

    http://www.website.com/en/foldername/the-books/thebookname/chapternumber/thefilename.aspx

    We want that this url should work like this:

    http://www.website.com/thefilename.aspx

    I could only manage this with URLREWRITING. The problem is that we have tons of such links and we have to do umbraco database lookup to find the "thebookname/chapternumber" foldernames and then apply the URL scheme.

    This way we get 200 OK and is not any redirect.

    Is there a way in Umbraco where we can define such things easily.

    Thanks.

     

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Aug 25, 2012 @ 14:56
    Chriztian Steinmeier
    0

    Hi Angelo,

    Take a look at the "magic" property umbracoUrlAlias for a way to accomplish this.

    Define that on your DocumentType and fill in the desired shortcut on the individual nodes, e.g.: thefilename in your example above - and Umbraco will serve that node's content on that URL.

    To prevent searchbots (i.e. Google :-) from flagging those as duplicate content, you can put a rel="canonical" (check Google for exact syntax) on the page, where you use the URL you get from NiceUrl() to tell the bot what the real URL is... 

    /Chriztian

  • Angelo 20 posts 72 karma points
    Aug 25, 2012 @ 16:20
    Angelo
    0

    Hi Chriztian,

    Wow, that's great! It's working wonderfully.  Two question related to this:

    One concern: www.site.com/filename and www.site.com/filename.aspx both works. Can't we somehow make only .aspx work. In the config files use directory mode is set to false already. 

    This way we get 3 duplicate URLs. What do you suggest for this? I was thinking to write URL rewriting to 301 redirect original url to this urlaliasurl.

    One problem I have is that we will have such thousands of URLs. Now, if we change the name of one URL, the old one will direct to 404. So, for this, I have to again create the code for the save event to record urlalias changes and store them in the 301 redirection bank.

    I found this tool: http://our.umbraco.org/projects/developer-tools/301-url-tracker which looked great but it only works automatically for umbracoUrlName variable.

    Can this or something else work for "umbracoUrlAlias" also?

    Thanks a lot for your help.

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Aug 25, 2012 @ 22:24
    Chriztian Steinmeier
    0

    Hi Angelo,

    If you can, I'd recommend you enable the "directory" URLs - the .aspx suffix is just annoying to use when giving somebody a URL - it's much better to just say: "Go to mysite dot com slash goodies" and not have to say "dot aspx" too.

    If you want to keep it like you do now (with the .aspx) it would probably be a good idea to add a URL rewrite for URLs without .aspx and route them to the .aspx version (one single generic rewrite). That way you could still use the .aspx-less version when handing out URLs — all internal URLs handled by Umbraco will be correct anyway, so no need to worry about those. 

    Regarding the duplicate URLs - that's why I mentioned creating a "CanonicalURL" macro to put in the <head> section of your Master. If you use that, you shouldn't be getting duplicate content on Google because it makes sure to always index the page on a single URL. 

    The problem with renaming pages — maybe take a look at 301 Moved Permanently - a package that works much like the umbracoUrlAlias, you create a special property and when you rename a page, you put the old name in that property, so Umbraco can find the page anyway and serve the 301 header.

    /Chriztian

  • Angelo 20 posts 72 karma points
    Aug 27, 2012 @ 04:43
    Angelo
    0

    Thank you so much for your reply. All clear :) Great tips!

    Love,
    Angelo 

  • 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