Laravel 5.3+ don’t load .env file

It was s strange situation… My JS and CSS files are versioned using an own method. In the asset() links a config value is included, which comes from the .env file, but after changing the needed value in the .env, nothing happened, the old file was loaded, instead of the new one…
So I’ve started to search for the reason.

My asset link looks like the following:

<link rel="stylesheet" href="{{ asset('/assets/css/occupancy_editor_v' . config('app.AssetFileVersion') . '.css') }}"/>

My .htaccess have one rewrite role:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule "^(.+)_v\d\d\d+\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$" "$1.$2" [L]

This ensures, that the _vxxx string will be rewritten to the original file name, but upon change of the file, the browser won’t load it from cache, because it gets the link with the _vxxx suffix…
In the _vxxx suffix, the xxx part comes from the .env file.

Checked the .htaccess, it was okay. Cleared the browser cache, nothing…

After some examination made on the dotenv library, it comes out, that values containing space required to put between ” signs. I’ve also had values containing ‘/’ sign, and it is a good thing to put them between “”-s too.

Vélemény, hozzászólás?

Az email címet nem tesszük közzé. A kötelező mezőket * karakterrel jelöljük.