: Multilingual website without language component in the URL I'm working on a website for Canada which will have French and English versions. For SEO purposes, I would like to avoid using any
I'm working on a website for Canada which will have French and English versions. For SEO purposes, I would like to avoid using any language tag in URLs because I believe it will have more impact (e.g. example.ca/products better than en.example.ca/products or example.ca/en/products).
I believe this is technically possible because the2 languages are sufficiently different that the URLs won't be conflicting with one another (e.g. if you want a "product" page, it will be /products in English, and /produits in French so you know which language the URL is about).
Since Google (and most likely others) doesn't rely on the URL (nor HTML tags) to determine the content language I don't see any problems with search engines.
To make this possible I've thought about using a cookie distinct from the session cookie (e.g. example.org_language) with long term expiry (e.g. N years) that will memorize the language chosen by the user. That way when people visit the website with a new browser session, they get served the proper language.
I have already given up on users being able to switch one page from English to French: when people will chose English or French from the menu they will be redirected to the corresponding version of the home page.
Do you foresee any problems with not using a language component in the URL (whether domain or path)? (as long as one makes sure URLS don't conflict).
More posts by @Lengel546
2 Comments
Sorted by latest first Latest Oldest Best
i think the proper way would be:
when user accesses site, get his language from browser using javascirpt
present the user with what you've found, askig to confirm. than save to session.
when the language is set in the session, give back the content in the language, no matter what url the client is visiting
google / bots etc. sould not interprete the javascript, they get what they requested via /products /produits ...
btw: if you f* around with products, you should take a look at "nopcommerce" it can take care of this several ways... altough it has its issues ...
You can create a $_SESSION or $_COOKIE var to store the language settings.
If you're doing a 2 lang site then you can create a language switcher that sets whichever var type you've used to store the set lang, and then reload the index page in that language, but in every case you'll have to choose a default language.
In consideration of returning users cookie would be better than session, but is susceptible to being disabled, so I would recommend using both with cookie being higher priority.
index.php
switch ($_REQUIRE['langvar']):
case default:
//load english content
break;
case 'french':
//load french content
break;
langswitch.php
if ($_REQUIRE['langvar']=='en') {
$_SESSION['langvar'] = 'fr';
} else {
$_SESSION['langvar'] = 'en';
}
header('Location: index.php');
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.