URL-rewriting for multilingual search engine optimization of ASP.net site with localization
Posted on 2004-04-19
I have created a multilingual website in ASP.net with some of the localized text pulled from a database and some from resource files and it works like a charm.
A possible problem is that the url of any particular page remains the same irrespective of the language served. This seems to be a problem for search engines because they would have different content (the same content in a different language) for the same url.
Also, if we don't know anything about the preferred language and the visitor is not making any selection, we will always and only serve english. Even if the spider would be able to select a language through the linkbutton we would continue to serve english because we can't place a cookie and a spider has no "UserLanguage" parameter in its requests. (Or does it?)
I also assume that I have to make each page available with different url for different languages being served. Of course, I don't actually want to create separate pages for the same stuff. What is the best way do rewrite the urls? I hope there is some way to request this in the web config or global.asax file with some instruction like:
if request.path contains "/de/" replace "/de/" serve document found at "(path found after "/de/")" but leave all links in the document unchanged.
This way, I could test for the requested urls what language they ask for and set the current thread's culture accordingly. I assume this would work much smoother than with request parameters (as in "...aspx?language=de") because such request parameters won't be in the links within the served page (or can they?) and some spiders might have trouble with parameters (the "dynamic pages problem").
Now, please tell me how to do such an url rewriting so that, for example, all german pages have a url with /de/ after the domain name (and english pages with an /en/) but I don't actually have to create and manage all those subdirectories.