I am developing multilanguage website using codeigniter. It is required to locate language at the beginning of the base url. what should I write in route.php, in of view, and so on, so to have the final result to look like the following:
lang.mysite.com
lang must be changed all times the language is changed Thanks a lot in advance.
you can do it dynamically on your routes.php.
Like:-
require_once( BASEPATH .'database/DB'. EXT );
$db =& DB();
$query = $db->get( 'routes_urls' );
$result = $query->result();
foreach( $result as $row ){
$route[$row->item_converted_url] = $row->item_url;
}
routes_urls are saved into db
as far as i understand from your question: it's not good to add language at the first of domain because browser deal with this language as sub domain, the best way to make url as the following www.somewebsite.com/en/controllerName/functionName and this things will be done in codeigniter easily : read this please https://github.com/bcit-ci/CodeIgniter/wiki/URI-Language-Identifier thanks :)