I have multilingual static content that I want to serve through Apache. Files are cache files created by the JIT application, so if they exist, they must be submitted, otherwise redirect the request to the application, which will create them in place.
I specify the language through the HTTP Accept-Languageheader, which can be hr, enbut also en-US,en;q=0.5(therefore there is no simple language to add to the file name to continue).
The urls are as follows:
In my application, I have a folder with exactly the same layout, only the language is added, for example:
/static/homepage.html.en
/static/homepage.html.hr
/static/script.js.en
/static/script.js.hr
, Accept-Language mod_negotiation :
/static /www/app/var/cache/static
<Directory /www/app/var/cache/static>
FileETag MTime Size
Options MultiViews
AddLanguage hr .hr
AddLanguage en .en
<IfModule mod_negotiation.c>
LanguagePriority en hr
</IfModule>
ErrorDocument 404 /index.php
</Directory>
, .
, :
- PHP ( )
mod_rewrite ( Accept-Language)- ( )
-, ?
:
/static /www/app/var/cache/static
<Directory /www/app/var/cache/static>
FileETag MTime Size
Options MultiViews
AddLanguage hr .hr
AddLanguage en .en
<IfModule mod_negotiation.c>
LanguagePriority en hr
ForceLanguagePriority none
</IfModule>
ErrorDocument 404 /index.php
ErrorDocument 406 /index.php
</Directory>