I have a website with 4 different languages. On the master language, Swedish, I want to always show the /sv/ part of the URL. If the visitor goes to mypage.com/news I want them to be "redirected" (both will of course be the same version of the page) to mypage.com/sv/news. What do I need to do to solve this?Thanks!
For the first part (adding the /sv to all paths) you should be able to do that by removing the "culture" value from the host names defined for your site. By doing that, paths which don't have a locale at the start will return a 404 not found response. For the redirect, it's down to you how you implement it. You could probably use rewrite rules in your web.config to look for URLs which don't start with a locale though remember to exclude things like /episerver (or whatever you've set as your CMS UI path) and any non-episerver URLs such as static assets.
Thank you for the answer! If I understand you correctly I should remove the value for Culture under Admin -> Config -> Manage Websites? Doesn't seem to change anything for me.
You understod Pauls instruction correctly.
You could install Alloy MVC sample, it has english and swedish languages enabled. There is no culture specified for the site hosts in admin.
Now when you start the site and navigate to http://localhost:SOME-PORT-HERE/ you get the english version of start page. If you click any of the top navi links you notice that the path contains the language identifier like so: /en/alloy-plan/ (and the swedish pages use /sv/ in the url, I think you need to create and publish the swedish language version of start page in the Alloy demo).
Edit: one thing that comes to my mind is that if this is an older site or you have changed the 'strictLanguageRouting' setting then it might behave differently (see this old blog post ).
Great answer, thanks! Will look into this.
strictLanguageRouting was set to false. Thank you for the help!