[rewrite] ENV. variables inside RewriteRule

Discussion in 'Apache' started by marmz, Sep 1, 2016.

  1. #1
    So.. i have some rules likes this:

    RewriteRule ^(it|en|fr|de|es)/(.*)$ mz_site.php?lang=$1&url=$2 [L,QSA]


    Now, i'd like to store my "list of languages" inside a variable and use it when i need ..
    something like this:

    RewriteRule (.*) - [E=LANGS:it|en|fr|de|es]

    RewriteRule ^(%{ENV:LANGS})/(.*)$ mz_site.php?lang=$1&url=$2 [L,QSA]

    But the rule doesn't work :(

    I have made some test, passing LANGS to php script:

    RewriteRule ^(it|en|fr|de|es)/(.*)$ mz_site.php?lang=$1&url=$2&langs=%{ENV:LANGS} [L,QSA]


    the script gets the values in $_GET['langs']
    so, the variable LANGS is correctly set.

    What i need to make it work??
     
    marmz, Sep 1, 2016 IP