jeudi 2 avril 2020

Configure html subdirectories languages

I'm creating a multi-language page The folders are with this structure:

root = /
Spanish = /
English = /en/
French = /fr/
Portuguese = /pt/

Within the root index.html i'm use the code:

 <!DOCTYPE html> <html lang="es"> <link rel="alternate"
 href="http://myweb.com" hreflang="es"  /> <link rel="alternate"
 href="http://myweb.com/en" hreflang="en"  /> <link rel="alternate"
 href="http://myweb.com/fr" hreflang="fr"  /> <link rel="alternate"
 href="http://myweb.com/pt" hreflang="pt"  /> <link rel="canonical"
 href="http://myweb.com" /> <head>

And within each sub-folder index it is configured like this:

Example English:

<!DOCTYPE html> <html lang="en"> <link rel="alternate"
href="http://myweb.com/" hreflang="x-default"  /> <link
hrel="alternate" href="http://myweb.com/en/" hreflang="en"  /> <link
hrel="canonical" href="http://myweb.com/" /> <head>

The problem is that I don't get the automatic redirection, when a user of each language enters the web.

Could you helpme please, I'm very new at it and I'm still learning.

Thanks.




Aucun commentaire:

Enregistrer un commentaire