Copied to clipboard

Flag this post as spam?

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


  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Aug 03, 2010 @ 12:27
    Tim
    0

    Making NiceUrl for root node return / or the domain

    Is it possible to get NiceUrl to return either the domain, or just / for the root (home) node? I've got the hostname set up to be the domain on the root node, but I still get /home when I call NiceUrl.

    This means I effectively have duplicate content, as /home and / are the same, but on different URLs. From an SEO point of view, this is a very bad thing, so I'd like to avoid it if possible. All the links to home in my navigation are hard coded to /, so no problem there, but my searches, and sitemaps, all use NiceUrl, which is returning the wrong value.

    Other than go into all the macros, and put in a check to see if its the homepage, and link to / if it is, or writing a UrlRewriting rule to 301 /home to /, is there an elegant way of doing this? I tried setting the Url name to /, but that just broke the homepage.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Aug 03, 2010 @ 12:33
    Matt Brailsford
    0

    Hi Tim,

    I do pretty much the same as you, and just hard code most links.

    Couple of options I would probably suggest are

    1) Setup a URL reewrite rule so that any /home links go to / instead on a 301 redirect. That way if any do get through, you search engine will see them as the same

    2) Setup your own XSLT extension library that replaces umbraco.lirary:NiceURL with your own method that does a check for the homepage, then just swap out your calls in your XSLT files.

    Matt

  • Ove Andersen 435 posts 1541 karma points c-trib
    Aug 03, 2010 @ 12:39
    Ove Andersen
    0

    I agree with Matts first option. If you don't have access to IIS, try the Permanent Redirect package:

    http://our.umbraco.org/projects/backoffice-extensions/permanent-redirect

    It is very easy to set up and use.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Aug 03, 2010 @ 12:45
    Tim
    0

    Thanks guys, I've gone for the 301 redirect in the UrlRewriting.Config file. It means I still have incorrect links on the site, but they're 301'd, so it's ok for SEO. Also, it means I don't render stuff like XSLT Search un-upgradeable by modding the XSLT.

    :)

Please Sign in or register to post replies

Write your reply to:

Draft