简体   繁体   中英

Homepage for multi-language website

I'm currently working on a multi language website project. I have two languages in my website (Russian, English). English is the main language.

Basically the problem is: Should I make the homepage like www.example.com/en OR www.example.com/ ? And maybe redirect to sub directory from main page? Or my main home page should have a sub directory or should it be empty?

better way is set default language as on defult url .. if you use framework like laravel of som... Language strings are stored in files within the app/lang directory. Within this directory there should be a subdirectory for each language supported by the application.

app
/lang
    /en
        homepage.php
    /es
        homepage.php

read this article i hope u can get basic idea about process of thishttps://laravel.com/docs/4.2/localization

The best way would be to use a language slug for every language, even the default one. Then, you can detect and redirect users based on their browser's language, redirecting always by 302. In your case, it would be as follows:

  • www.domain.com, redirect by 302 to browser's language or other selected by default, for example English: 302 to www.domain.com/en.
  • www.domain.com/en
  • www.domain.com/ru

It is important to remember that you should redirect users only if they are requesting the canonical domain or the default subdomain: www.domain.com or domain.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM