Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: [rewrite] ENV. variables inside RewriteRule |
|
Author |
|
marmz
Joined: 24 Aug 2016 Posts: 3 Location: Italy, Pescara
|
Posted: Thu 01 Sep '16 15:30 Post subject: [rewrite] ENV. variables inside RewriteRule |
|
|
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
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
|
Posted: Wed 07 Sep '16 16:48 Post subject: |
|
|
The Env vars can't be used that way.
Use $_SESSION in php to save the language. |
|
Back to top |
|
|
|
|
|
|