Mobile app version of vmapp.org
Login or Join
Bryan171

: How do you set up the directory structure for a multilingual site without duplicating content? I want to make a website in two languages. I've looked around and settled on the directory option

@Bryan171

Posted in: #Multilingual

I want to make a website in two languages. I've looked around and settled on the directory option of separating both languages. How do I make it work?

Let's say I have the following three files for the landing homepage, the English page and the Spanish page:
www.domain.com/index.html http://www.domain.com/en/index.html www.domain.com/es/index.html

Let's also say that /index.html will be in English, with a link to /es/index.html. In turn, /es/index.html will have a link to the English version. Would this be back to /index.html or to /en/index.html? How do I get both English versions (the one at the root and the one in the directory) to actually be the same file in the same directory?

I'm new to this, so I'm not using any scripts yet. To me, the obvious solution is to duplicate both English versions and have the one at the root point to files under the /en/ directory, but I'm not a fan of duplication and I've learned that search engines really frown upon that. Anyone point me in the right direction?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

3 Comments

Sorted by latest first Latest Oldest Best

 

@Bethany197

To avoid having to duplicate the index.html on domain.com/index.html and domain.com/en/index.html , the best SEO friendly solution is to use a 301 redirect on your .htaccess file (works only on Apache servers).

Edit or create your .htaccess file adding the following line :

redirect 301 /en/index.html www.domain.com

This way, whenever someone tries to access to domain.com/en/index.html will be automatically redirected to the domain index, and you don't have to worry about different versions of the same file or analytics and ranking being divided between the duplicated index.

10% popularity Vote Up Vote Down


 

@Mendez628

Even though you're new to this, I suggest I'd do is to use a PHP script to handle this.

You can use mod_rewrite to rewrite the urls /en/, /es/, etc. to say language.php?lang=en, set a cookie for the language, and redirect back to index.php or even mod_rewrite back to /en/index.php.

Otherwise, @Eric Petroelje's answer is your best bet.

10% popularity Vote Up Vote Down


 

@Ann8826881

I think you are on the right track here. There are a few ways I've seen this done:


Have the domain.com/index.html page be a simple language selection page with only links to the en and es home pages. Personally I find this annoying, but I still see it all the time.
Just sent everyone to the english version and have a link from there to the spanish version. This is probably the best option if a large percentage of your users will be english speaking.
Attempt to auto-detect language in some server side code, probably by looking at the Accept-Language header to see which language the user prefers, then send them to the appropriate page.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme