Skip to content

allowing search engines to spider all your langages

Derek Jones edited this page Jul 5, 2012 · 20 revisions

Category:Help | Category:Help::TipsAndTricks | Category:Help::SEO

This wiki is for CI 1.5.4. I assume it has to work with 1.5.3, but can't confirm with any other version.

I recently came across the problem where a search engine only indexed one language on my website, even with Roland Blochberger's language selector found here: Language Selection. Here is how I got around it (see a working model)

In the httpdocsroot of your CodeIgniter installation, make as many copies of the index.php file as you have languages. For example, I made copies for french and english like "index_french.php" and "index_english.php". Then, in each of those files you created, add this at line 46

    $language_index    = "english"; 
//allowed values are those for which you have language files properly installed in CI
//change english for the language pertinent to this file

Then, add

define('APP_LANGUAGE', $language_index);

at line 97, still, for all of the files you created.

And last, I changed, respectively, lines 26 and 40 for

$config['language']    = APP_LANGUAGE;
and
$config['index_page'] = "index_".$config['language'].".php";

in system/application/config/config.php

Now, if you'd like, change your index.php page to have a page that links to any or all of your new files. This page can create a cookie for the visitor's next visits. You may also want to add links to other languages in your header file so one can still see other available languages. What you do with this from here on is your's.

Hope this helps someone somewhere.

Marc Arbour marbour at ci2 dot ca Ci2.ca | Ci3.ca

Clone this wiki locally