Home » Php » php – Htaccess url multilanguage

php – Htaccess url multilanguage

Posted by: admin February 25, 2020 Leave a comment

Questions:

I would like the language accepted by the browser to be automatically added via htaccess. Guy

www.test.com/en/
www.test.com/ru/

My problem is that I have href of this type:

“/user/sign-up”

“/CEO/register”

etc..

I use a php file to do the routes:

 

case '/user/sign-up':   
    require $_SERVER['DOCUMENT_ROOT'].'app/SignUp.php';
    break;

etc…

The urls are all without the language, that is: www.test.com/ceo/register

I only have two languages ​​that I accept ru and en. Also if the user changes the language I save the setting inside a session

Do you know how I can do it?

How to&Answers: