RewriteLog C:\tempiirf\iirf.out
RewriteLogLevel 3

# if the url is: "domain.com/en/" or "domain.com/th/" 
# strip the language from the url but not from the address bar and go to the default.aspx page.
# remember the origional url by putting it in the HTTP_X_REWRITE_URL header.
# the HTTP_X_REWRITE_URL i can then get in ASP.NET to see what language the user
# put in the address bar.
# this way, google can find an English url and a Thai one. 
RewriteRule ^/(en|th)/$ /Default.aspx [U]

# If default.aspx is hidden in the address bar, we still need to know we have to go to
# default.aspx.  We want this to be a rewrite, not a redirect, so that we do not 
# show the ugly default.aspx in the address bar.
RewriteRule ^$ /Default.aspx

# for all other pages the language is removed from the url, but not the address bar. This way I don't have to change
# anything in my code. ASP.NET will get to work with the stripped url while i can get to know what language the 
# request is in via the HTTP_X_REWRITE_URL again.
# Could also map the language to a query param, but we don't.  
RewriteRule ^/(en|th)/(.+) /$2 [U]

Last edited Oct 3, 2008 at 5:22 AM by Cheeso, version 3

Comments

watermarkshaun Dec 4, 2008 at 2:45 AM 
# Could also map the language to a query param, but we don't.
But this is exactly what I need - how is this done??

elgerm Oct 4, 2008 at 5:30 PM 
Nice one ;)

I think the HTTP_X_REWRITE_URL is a much cleaner solution for multilingual purposes because you can use query params without having to worry about 2 times the '?=' in the querystring and separate the language from id's / names etc.