'Language neutral entry pages

My old web site has an index.html page … nothing strange! Everything is fine.

The new web site has an english and a french version, so the new index is index.php?lang=eng…. That makes sense.

I don’t like to make a front page that will say “english” or “french”. But that’s not good for ranking or seo.

So the question is: How do I manage to get a default index.php with request (?lang=eng) to become the front page?



Solution 1:[1]

  • domain.com/en/index.php
  • domain.com/fr/index.php

Use url rewriting with regular expressions (mod_rewrite, ISAPI, whatever) to handle requests to relevant pages so

  • domain.com/en/index.php REWRITE TO domain.com/index.php?lang=en
  • domain.com/fr/index.php REWRITE TO domain.com/index.php?lang=fr

This way your pages are two seperate pages to search engines but handled via one gateway in code. I'm not a regex expert but it would be a very simple regex I would imagine

Solution 2:[2]

I'm not sure I understand the question. It seems to have two parts:

How to provide a default language of English:

$lang = empty($_GET['lang']) ? "eng" : $_GET['lang'];

Do you also have a problem of where to put the English/Francais links so search engines don't ding you? I wasn't aware of this problem.

It might also help to let us know if you're using a CMS, and if so which one.

Solution 3:[3]

Unless I'm misunderstanding the question, in index.php, when you check the language, put something like this:

$lang = @$_GET['lang'];
if ( empty($lang) ) $lang = 'eng';

Solution 4:[4]

Just put an argument in the php code that says :


if (lang == "")  // haven't done php in a while so the syntax is probably wrong
{
  lang = "eng";
}
In other words, if there isn't an argument on the lang variable, you can just set it to be eng automatically, and so the first page will default to English every time, unless told otherwise.

Solution 5:[5]

Just make the default english and offer an option on the index page to change to french? This, of course, depends on what language most of the visitors speak, which isn't all that hard to figure out with visitor logs.

Solution 6:[6]

I would use a neutral URL for entry, such as:

http://example.com/foo/bar

On this page I would do some language negotiation or simply ask the user for the prefered language. Then I can redirect to the language specific URL:

http://example.com/en/foo/bar

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nick Allen
Solution 2 General Grievance
Solution 3
Solution 4 Ed James
Solution 5 Stefan Thyberg
Solution 6 Gumbo