Multiple language when using public folder in htac

2019-05-13 23:44发布

问题:

I have this .htacces file I like it a lot but how do I add multi language to it? so it understand that localhost/en/ is not a file or folder. right now it use a public folder as the "root" so localhost = public/

Great if I then wanna do so I still use the public folder as a root but the first / / in the url is the language

Example: localhost/en/ = link to the public folder and localhost/it/ also link to the public folder

Example 2: localhost/en/admin link to public/admin/

PS: the public/ is not suppose to been seen in the URL

This code do exactly what I wan't except the part with language.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(public)/
RewriteRule (.*) /public/$1

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]


ErrorDocument 401 /errors/errors.php
ErrorDocument 404 /errors/errors.php
ErrorDocument 500 /errors/errors.php