I have an .htaccess file. With this file, I am detecting the language code by subdomain (HTTP_HOST).
There is no problem here, however, when I redirect incoming requests to the files under the public folder, I get a 404 error and also the language becomes inoperable.
SetEnv DEFAULT_LANG en
<IfModule mod_rewrite.c>
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Set the language parameter by HTTP_HOST
RewriteCond %{HTTP_HOST} ^([a-z]{2})\.([a-z0-9-]+\.[a-z]+)$ [NC]
RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
# Set the language parameter default
RewriteCond %{ENV:LANGUAGE} ^$
RewriteRule (.*) - [QSA,E=LANGUAGE:en]
# Set the language query string if absent
RewriteCond %{QUERY_STRING} !language=
RewriteRule ^(.*)$ $1?language=%{ENV:LANGUAGE} [QSA]
# Finally rewrite the request URI to the /public folder
RewriteCond %{REQUEST_URI} !^/public
RewriteRule ^(.*)$ /public/$1 [L]
</IfModule>