Hi Dan,
You can change the behaviour for the trailing slash by editing the /config/UmbracoSettings.config file - look for addTrailingSlash.
Also, if you're looking at SEO with Umbraco, I highly recommend the SEOChecker package - it's a commercial package, 99 Euro - but I think you'll find it's a great investment.
EDIT: I should have read your comment more thoroughly - of course you already found that setting - anyways, take a look at SEO Checker - it handles a lot of the SEO issues, and also has built-in redirection for old/broken links and a range of other issues.
Thanks for the advice guys. I had found the rewrite module and SEO checker and will look at implementing them. We already use the URL Tracker.
Can URLRewriting.config not be used?
I guess my point is that I can see no reason why you would want to be able to access a page with and without a slash therefore why do we need to implement a workaround to stop it happening and is this not a bug in the addTrailingSlash config?
Hi Dan,
Yes, you could use the URLRewriting.config module - it's just an alternative to the IIS Rewrite Module, that's all; either solution could be used.
If you think it's a valid issue, put it up on http://issues.umbraco.org - best way to get feedback on it with the Core team (you could also link the new issue here).
This creates another problem since resources are not loaded if a trailing slash is added to its path (such as file.js/). Do you know of any workaround?
Trailing slash / no slash - SEO
Google recommends that there should be a unique URL for each page or if not then a 301 redirect or rel="canonical" be used.
However Umbraco will serve the same page up on URLs with and without a trailing slash.
e.g.
www.mysite.com/about-us is the same as www.mysite.com/about-us/
There is a setting which will add the slash to all URLs generated by Umbraco but does not stop access via the page without the /.
The documentation advises how to create a canonical URL for a page:
https://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/canonicalurl/
This however will create 2 different canonical URLs depending on whether the user is on the page with the / or without.
So I'm wondering:
Is there an easy solution to this.
Why is this solution not part of the core when it's quite a fundamental SEO issue.
Hi Dan, You can change the behaviour for the trailing slash by editing the /config/UmbracoSettings.config file - look for
addTrailingSlash
.Also, if you're looking at SEO with Umbraco, I highly recommend the SEOChecker package - it's a commercial package, 99 Euro - but I think you'll find it's a great investment.
http://soetemansoftware.nl/seo-checker/features
EDIT: I should have read your comment more thoroughly - of course you already found that setting - anyways, take a look at SEO Checker - it handles a lot of the SEO issues, and also has built-in redirection for old/broken links and a range of other issues.
Hi Dan, what you want to do is use the rewrite capabilities of the IIS Rewrite Module. Ruslan has made a great blog post on this: http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/#trailing-slash
You can choose to either remove or add trailing slashes to all urls:
Remove trailing slash to urls
Add trailing slash to urls
Thanks for the advice guys. I had found the rewrite module and SEO checker and will look at implementing them. We already use the URL Tracker.
Can URLRewriting.config not be used?
I guess my point is that I can see no reason why you would want to be able to access a page with and without a slash therefore why do we need to implement a workaround to stop it happening and is this not a bug in the addTrailingSlash config?
Hi Dan, Yes, you could use the URLRewriting.config module - it's just an alternative to the IIS Rewrite Module, that's all; either solution could be used.
If you think it's a valid issue, put it up on http://issues.umbraco.org - best way to get feedback on it with the Core team (you could also link the new issue here).
I know I'm a bit late to the party, but here are UrlRewriting.config versions:
Add Trailing Slash
Remove Trailing Slash
Hope this helps someone. (NOTE: Use either one or the other; not both!)
unable to find "UrlRewriting.config"
This creates another problem since resources are not loaded if a trailing slash is added to its path (such as file.js/). Do you know of any workaround?
Thanks Robert. Only problem is I can't find a UrlRewriting.net rule that does this!
I will submit to the issue tracker.
Submitted - http://issues.umbraco.org/issue/U4-7025
There's actually even more ways to access a page:
www.mysite.com/about-us www.mysite.com/about-us/ www.mysite.com/about-us.aspx www.mysite.com/1223 www.mysite.com/1223.aspx
So 5 ways to get to a single page.
Vote for it if you agree! It's in the recommendations:
https://support.google.com/webmasters/answer/66359
Great. Thanks for the help. Saved me some time figuring out writing the rewrite rule.
Kind Regards
David
Hi Peeps,
I added a re-write rule and this worked for all my pages but this then introduced a bug loading Umbraco's back-end. It simple didn't load.
I tested removing the re-write rule again and the back-end was fine so its defo related.
Any ideas to how to get this re-write rule working but not effecting the back-end login.
Umbraco version 7.7.9 assembly: 1.0.6596.21099
Thanks in advanced!
Kind Regards
David
Hi David,
You probably need to add this rule before your rewrite rule that changes the url.
This will stop the rewrite from happening on umbraco related urls.
Dave
Absolute legend! That worked a treat.
Thanks for your help.
Kind Regards
David
is working on a reply...