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.
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.
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.
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.
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
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.
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.
:)
is working on a reply...