Solved

URL-rewriting for multilingual search engine optimization of ASP.net site with localization

Posted on 2004-04-19
3
834 Views
Last Modified: 2012-05-04
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.

The site first checks whether the visitor has cookie information about the preferred language. If not, it checks the Page.Request.UserLanguages for the preferred language and tries to match that. It then also attempts to place a cookie. If the visitor wants yet another language, he/she can select a different language through a linkbutton (JavaScript) to change the language selected and the site also updates the cookie accordingly.

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?)

Now, as a consequence, I believe that I have to handle the user's conscious language selection through a plain html link with no JavaScript for spiders to select the language because spiders don't process JavaScript.

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.

Thank you!
0
Comment
Question by:ddetering
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
ihenry earned 385 total points
ID: 10869302
These few links contains information about url rewriting and http pipeline handling in ASP.NET,

URL Rewriting in ASP.NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/URLRewriting.asp

Rewrite.NET -- A URL Rewriting Engine for .NET
http://www.15seconds.com/issue/030522.htm

HTTP Handlers and HTTP Modules in ASP.NET
http://www.15seconds.com/issue/020417.htm

MSDN Magazine - Intercept, Monitor, and Modify Web Requests with HTTP Filters in ISAPI and ASP.NET
http://msdn.microsoft.com/msdnmag/issues/02/08/HTTPFilters/default.aspx

Securely Implement Request Processing, Filtering, and Content Redirection with HTTP Pipelines in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/02/09/HTTPPipelines/default.aspx
0
 
LVL 1

Author Comment

by:ddetering
ID: 10870347
Funny - I didn't receive notification about this answer... Just wanted to post my new approach which I hope will work and solve my problems in a better way than rewriting the url. Nevertheless, ihenry, I'll check your answer and award the points to you if you deserve them ;)

So, as a matter of fact, I am directing multiple international domains to the site anyway. The simple answer is that I can leave the language selection javascript-based _in order_ to prevent search robots from using it. For each Application_BeginRequest (or will it be sufficient for each Session_Start) event I first check whether there is a cookie with language preferences (robots don't have a cookie). If not, I see whether there is a preferred UserLanguage that I can match (robots don't have that either). If not, I check whether the client requests an international domain:

ElseIf CurrentPage.Request.ServerVariables("server_name").ToString.IndexOf("domain.de") > -1 Then
Thread.CurrentThread.CurrentCulture = New CultureInfo("de-DE")

Else (and finally,) I serve the default english content.

As a result, I can submit the international domains and be confident that the robots will index my site only once for each language, and each language has a different url for the same page in the search engine results and the urls in the search engine results also match the expectation of most search engine users.

Possible problems will only arise once I add languages that don't match as nicely an international domain, e.g. Spanish for hispanics in the US or french for francophones in Canada. I guess I will then finally have to apply url rewriting.
0
 
LVL 1

Author Comment

by:ddetering
ID: 10878594
I think this will work when I eventually will need it, but I haven't tried it yet. I particularly like the first article. However, I had thought that this url rewriting would work with just a few lines of code in the global.asax, but I guess not...
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question