umbracoUseDirectoryUrls & addTrailingSlash => one node has multiple URLs
Hello!
I am using umbracoUseDirectoryUrls & addTrailingSlash. It works fine, but the problem is that every node has three valid URLs: /node.aspx, /node and /node/. You can see it at this Our Umbraco forum URLs, it works the same. Multiple URLs for one content page is bad for SEO. How can I force Umbraco to use only /node/ ULRs and raise 404 at the /node.aspx and /node URLs?
Also, at current state I am not able not use 301 URL tracker to redirect from /default.aspx to / or from /node.aspx to /node/.
Usually it's not really a big problem if the site is born with the directory urls instead of the .aspx url's since nobody is linking to the .aspx version anyway. It would really be some weird edge-cases where it would happen. However if the site started out being based on .aspx url's and then is being switched to use directory urls then of course it can be a really big problem.
But give the code from the link a go and let us know if it works for you :)
Thank you very much Jan, it looks like that this is exactly what I need. I changed your example to work for my scenario: http://snipt.org/AGab6 - it 301 redirects /node and /node.aspx to /node/.
Today I don't have much time to test it thoroughly, but right now I don't see any problems.
Btw, what is this (?![0-9]+.aspx) part of your regex good for? It looks like it skips numeric URLs ending with .aspx. Is safe to remove this part or are such an urls somehow used by Umbraco?
Sounds got - However I can't really take credit for the script I just googled the issue you described so I'm not really sure about what the regex is exactly saying there. Sorry.
But please keep us updated in this post if you figure it out or has further improvement suggestions.
Well, then I think it is ok to remove that part of regex, it just skips rewriting for urls like /564651Xaspx. My first thought was that such an urls are used by Umbraco, but it is probably not that case.
Thank you again Jan for you help, I tried to mark your reply as an answer, but I can not do it, maybe not enough karma.
Well since it's removing numbers must be because the original creator is making sure that the pages are not indexed with their page id since previews are using the node id to access the page but I don't think it will ever cause an issue with duplicate content so yes I also believe it should be safe to skip that part.
Would you mind sharing what your modified rewrite rule looks like so others can benefit from it if they come across this post?
You're very welcome - I think you should be able to mark a question as the solution no matter the karma score. But if I remember correctly you can't give me a high five. But underneath the avatars there should be a "mark as solution button" :)
Seems there has been some hiccups on the forum today, which Sebastiaan should have fixed by now. This unfortunately happens from time to time but work is being done to improve the forums - In fact I'm digging into it next week myself :)
umbracoUseDirectoryUrls & addTrailingSlash => one node has multiple URLs
Hello!
I am using umbracoUseDirectoryUrls & addTrailingSlash. It works fine, but the problem is that every node has three valid URLs: /node.aspx, /node and /node/. You can see it at this Our Umbraco forum URLs, it works the same. Multiple URLs for one content page is bad for SEO. How can I force Umbraco to use only /node/ ULRs and raise 404 at the /node.aspx and /node URLs?
Also, at current state I am not able not use 301 URL tracker to redirect from /default.aspx to / or from /node.aspx to /node/.
Any idea how to solve that? Thank you.
Hi Fido
Try having a go with this url rewrite stuff - you can place this in the /config/urlrewriting.config file
http://snipt.org/tnolj/
Usually it's not really a big problem if the site is born with the directory urls instead of the .aspx url's since nobody is linking to the .aspx version anyway. It would really be some weird edge-cases where it would happen. However if the site started out being based on .aspx url's and then is being switched to use directory urls then of course it can be a really big problem.
But give the code from the link a go and let us know if it works for you :)
/Jan
Thank you very much Jan, it looks like that this is exactly what I need. I changed your example to work for my scenario: http://snipt.org/AGab6 - it 301 redirects /node and /node.aspx to /node/.
Today I don't have much time to test it thoroughly, but right now I don't see any problems.
Btw, what is this (?![0-9]+.aspx) part of your regex good for? It looks like it skips numeric URLs ending with .aspx. Is safe to remove this part or are such an urls somehow used by Umbraco?
Hi Fido
Sounds got - However I can't really take credit for the script I just googled the issue you described so I'm not really sure about what the regex is exactly saying there. Sorry.
But please keep us updated in this post if you figure it out or has further improvement suggestions.
Cheers,
Jan
Well, then I think it is ok to remove that part of regex, it just skips rewriting for urls like /564651Xaspx. My first thought was that such an urls are used by Umbraco, but it is probably not that case.
Thank you again Jan for you help, I tried to mark your reply as an answer, but I can not do it, maybe not enough karma.
Hi Fido
Well since it's removing numbers must be because the original creator is making sure that the pages are not indexed with their page id since previews are using the node id to access the page but I don't think it will ever cause an issue with duplicate content so yes I also believe it should be safe to skip that part.
Would you mind sharing what your modified rewrite rule looks like so others can benefit from it if they come across this post?
You're very welcome - I think you should be able to mark a question as the solution no matter the karma score. But if I remember correctly you can't give me a high five. But underneath the avatars there should be a "mark as solution button" :)
Cheers,
Jan
I tried to click mark as an answer multiple times, at first it works, but when I refresh the page it is not preserved.
Here is my solution based on yours: http://snipt.org/AGI2
First rule 301 redirects /node.aspx to /node/ and the second one 301 redirects /node to /node/. Both rules skip URLs starting with /umbraco/.
And now it is even marked as an answer, looks like I have to click "mark as an answer" and right after that post a message.
Hi Fido
Seems there has been some hiccups on the forum today, which Sebastiaan should have fixed by now. This unfortunately happens from time to time but work is being done to improve the forums - In fact I'm digging into it next week myself :)
Thanks for sharing your solution btw!
Cheers,
Jan
is working on a reply...