logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: [rewrite] ENV. variables inside RewriteRule
Author
marmz



Joined: 24 Aug 2016
Posts: 3
Location: Italy, Pescara

PostPosted: Thu 01 Sep '16 15:30    Post subject: [rewrite] ENV. variables inside RewriteRule Reply with quote

So.. i have some rules likes this:

Code:
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:

Code:
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 Sad

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

Code:
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??
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 07 Sep '16 16:48    Post subject: Reply with quote

The Env vars can't be used that way.

Use $_SESSION in php to save the language.
Back to top


Reply to topic   Topic: [rewrite] ENV. variables inside RewriteRule View previous topic :: View next topic
Post new topic   Forum Index -> Apache