lang in query string
Sijis Aviles
sijis at fedoraproject.org
Wed Aug 18 04:19:16 UTC 2010
2010/8/16 Miguel Sánchez de León Peque <msdeleonpeque at gmail.com>:
> How do Fedora websites change the URL from
>
> fedoraproject.org/?lang=en
>
> to:
>
> fedora project.org/en/
>
> in the browser's displayed URL?
>
>
> Thanks for your help! :-)
> Miguel
>
In apache under /etc/httpd/conf.d/ we have a file that has the
following (I've condensed the languages):
---
AddLanguage ar .ar
AddLanguage as .as
AddLanguage ast .ast
LanguagePriority en
ForceLanguagePriority Prefer Fallback
AddDefaultCharset utf-8
RewriteEngine on
# this is the magic, you are asking about
RewriteCond %{QUERY_STRING} ^lang=(ar|as|ast|more|lang|codes)$
RewriteRule ^(?:/(?:ar|as|ast|more|lang|codes))?(/.*)$ /%1$1? [R=301]
AliasMatch ^(?:/(?:ar|as|ast|more|lang|codes))(/.*)?$
/path/to/fedoraproject.org$1
<Directory /path/to/fedoraproject.org>
Options MultiViews
SetEnvIf Request_URI ^/ar/ prefer-language=ar
SetEnvIf Request_URI ^/as/ prefer-language=as
SetEnvIf Request_URI ^/ast/ prefer-language=ast
</Directory>
---
Hope this helps.
Sijis
More information about the websites
mailing list