|
SEO trick: multiple languages site friendly urls
I'm using this forum since about one month now, and it helped me a lot. I guess it's my turn now to help around.
So here it is: a free recipe to get better ranking when you use multilingual sites.
Enjoy!
We always try to stuff our URLs with keywords (or we should). For a classifieds section of a site, the url should contain the word 'classifieds' for example.
A too often forgotten thing is that URL should contain the matching keyword for each supported language of the website.
If you support French, 'classifieds' should be replaced by 'petites-annonces'.
Here's a trick I am using to have a friendly url in each language of a website.
Let's say you have a script named classifieds.php and you use some .htaccess rewrite rules to call it from /classifieds/en/ (hence the script name and the language code).
The language code is saved in the global $GLOBALS['lang'].
You can set up a global array for each language matching the script name to the keyword you want to show up in the URL.
$GLOBALS['links']['fr'] = array('classifieds' => 'petites-annonces');
$GLOBALS['links']['en'] = array('classifieds' => 'classifieds');
This rewrite rule in your .haccess will redirect the URLs ending by petites-annonces/fr/ to classifieds/fr/ (the script name plus its language argument).
RewriteEngine on
RewriteRule ^petites-annonces/fr/ classifieds/fr/ [L]
Now, you need to rewrite any link to the classifieds section to take into account your language:
classifieds/$GLOBALS['lang']
will become
$GLOBALS['links'][$GLOBALS['lang']]['classifieds']/$GLOBALS['lang']
Thus you will get 'classifieds/en' for your English section and 'petites-annonces/fr' for your French section.
Hoping it will help you
PS: if you want a real-life example, check the signature: the Mancko website is exactly done this way.
|