how to set language
how can I set the language (en, da, de etc) with mod_rewrite?
all files are located in the same dir
url to set language is
?set_lang=da
rewrite:
www.domain.com/en/index.php => www.domain.com/index.php?set_lang=en
www.domain.com/en/another_page.php?cat=black => www.domain.com/another_page.php?set_lang=en&cat=black
www.domain.com/da/index.php => www.domain.com/index.php?set_lang=da
www.domain.com/da/another_page.php?cat=black => www.domain.com/another_page.php?set_lang=da&cat=black
EDIT:
my .htaccess looks like this
RewriteCond %{HTTP_HOST} ^domain\.net$ [NC]
RewriteRule ^(.*)$ http://www.domain.net/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.domain\.net$ [NC]
RewriteCond %{REQUEST_URI} !^/_domain\.net/ [NC]
RewriteRule ^(.*)$ /_domain.net/$1 [L]
RewriteCond %{HTTP_HOST} ^(demo|mysql|secure)\.domain\.net$ [NC]
RewriteCond %{REQUEST_URI} !^/_domain\.net/_(demo|mysql|secure)/ [NC]
RewriteRule ^(.*)$ /_domain.net/_%1/$1 [L]
RewriteCond %{HTTP_HOST} domain\.net$ [NC]
RewriteCo开发者_如何学Gond %{REQUEST_URI} !^/_domain\.net/ [NC]
RewriteRule ^(.*)$ http://www.domain.net/$1 [L,R=301]
I found a solution
RewriteCond %{HTTP_HOST} domain\.net$ [NC]
RewriteCond %{REQUEST_URI} ^/(da|en)/(.*)(\?%{QUERY_STRING})?$ [NC]
RewriteRule ^(.*)$ /%2?%{QUERY_STRING}&set_lang=%1 [L]
精彩评论