URL structures are an important part of SEO. Its very important that our sites do not appear to serve duplicate content. However there is one feature of EPiServer that can do exactly that, namely when using language branches in the URL and viewing content in the master langauge.
For example, even with Globalisation switched off, this particular post could be accessed on the two following URLs:
Google and SEO people in general do not like this and see it duplicate content. The normal approach is to use a canonical URL to let Google know that the "/en/" version of the page is not the original one.
However I was never wholly satisfied with that as we should never (ever) need to serve up content on the /en/ branch as its the master language anyway.
I've used solutions in the past that have used 3rd party rewriters to get around this problem. However this never seemed a decent solution as we are adding more code into our solutions.
IIS7 has a URL rewrite feature that can do this for us very easily. To enable a 301 redirect of all "/en/" requests simply set the rule as follows (IIS > Your Site > URL Rewrite):
Or for those that are more inclined to do this in code then the following entry in the <system.webServer> element in web.config does the trick:
This solution is already in use on this site so I can confirm it works!
Please feel free to comment below or twitter me with any feedback @davidknipe