lang in query string

Sijis Aviles sijis at
Wed Aug 18 04:19:16 UTC 2010

2010/8/16 Miguel Sánchez de León Peque <msdeleonpeque at>:
> How do Fedora websites change the URL from
> to:
> fedora
> 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))(/.*)?$

<Directory /path/to/>
  Options MultiViews

  SetEnvIf Request_URI ^/ar/ prefer-language=ar
  SetEnvIf Request_URI ^/as/ prefer-language=as
  SetEnvIf Request_URI ^/ast/ prefer-language=ast

Hope this helps.


More information about the websites mailing list