# 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]