After long talk to client:
URLs must stay the way they are. No suffixes no prefixes,
no subdomains, etc.
Checked other magento projects none of them have same behavior. :S
Most likely some of plugins is causing this.
I came up with simple solution but it didn't work.
Basicly idea was to check request via $_SERVER, check
URL and determinate which store to load inside of index.php
Mage::run($storeID);
but nothing happend...
Same problem again.
Here is another piece of code but I don't like it (it works but its stupid).:
$link=mysql_connect("localhost","username","password");
mysql_select_db("database",$link);
$path= substr($_SERVER['REQUEST_URI'],1) ;// remove starting slash
$sql = "SELECT store_id FROM `core_url_rewrite` WHERE request_path = '{$path}'";
$rez= mysql_fetch_object(mysql_query($sql,$link));
if(!empty($rez)){
// found the url and storeID
$store= $rez->store_id;
if($store != Mage::app()->getStore()->getId()){
// is store == current store?
//Mage::app()->setCurrentStore($store);
if($store==1) $storeID="hr"; else $storeID="en";
$_SERVER['REQUEST_URI']=$_SERVER['REQUEST_URI']."?___store=".$storeID;
// Mage::run($storeID); // doesn't work.
header("Location: ".$_SERVER['REQUEST_URI']);
die; // just in case
}
}
Mage::run($mageRunCode, $mageRunType); //default exec