language redirect

Plain text code posted
created at 16 Sep 16:12

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
        # Automatically redirect requests on / according to the
        # "Accept-Language" HTTP header, if a translation is
        # available for that language.
        RewriteEngine On                          
        RewriteCond %{HTTP:Accept-Language} (\w\w)
        RewriteCond %{DOCUMENT_ROOT}/%1 -d
        RewriteRule ^/$ /%1/ [QSA,R=302,L]

        # If not, go to English.           
        RewriteCond %{DOCUMENT_ROOT}/%1 !-d
        RewriteRule ^/$ /en/ [QSA,R=302,L]
495 Bytes in 1 ms with coderay