I'm currently migrating a application from a very old symfony 2.1 version into a symfony 6 version.
And there is one piece of code that doesn't work anymore I cannot understand:
inside htaccess file there is multiple definitions like this one :
RewriteCond %{HTTP_HOST} ^www\.cg\.mywebsite(\.com)?(\:[0-9]+)?$
RewriteRule (.*) $1 [E=COUNTRY:57]
Which says that if the host patterns follows the rewrite cond, then I can get my country value equals to 57 in my PHP code
$country = $request->server->get('COUNTRY', 1);
This works just fine in the old application, but in the new one I always get 1, as if country was not defined at all
Old application: Symfony 2.1 / Php 5
New application: Syfony 6 / Php 8
getenv('COUNTRY), ordump($_SERVER)` and see ifCOUNTRYis there?.htaccessfile the environment variable could be getting renamed toREDIRECT_COUNTRYbefore your application receives the request (andCOUNTRYis not being re-set). You should also be setting this likeRewriteRule ^ - [E=COUNTRY:57]- and this could even resolve the issue in some cases (because there is no substitution the rewrite engine does not start over).$_SERVER,$_ENV(or having a look atphpinfo()) can hopefully shred light on that..htaccessis an Apache config file. If you are using the local "built-in" web server then your.htaccessfile is not processed (so the env var will not be set). stackoverflow.com/questions/53759815/…