Having a sitecore website. Situation is for every country, there are two URLs that you can use to hit the homepage.
www.abc.com/en/home
and
www.abc.com/en
We only want one – this is bad for both SEO and analytics.
I want to retire www.abc.com/en/home and want www.abc.com/en to only work.
I already worked with embedded URL = always in web.config but didn’t worked for me.
3
Answers
With the help of you guys all finally my bug is resolved and I came up with code which works in every situation like appended query string or without it.
Try this :)
If you use LanguageEmbedding.Always in the LinkManager.
Links generated with the Sitecore LinkManager have always a language code.
But the other urls will also work.
You can use a Canonical see Tip 17 for search engines.
Or you can do a redirect if the url not match with the url you want.
Or block/redirect the url’s in you netwerk/loadbalancer/webserver or redirect module or Sitecore
<httpRequestBegin>
pipeline. (just what you find convenient)A simple solution is place a peace of code in your master page something like this:
Also works for url aliases.
Use the IIS URL Rewrite module with the following rule: