1
votes

We have sitemap.xml with URLs and google analytics started to throw errors like this not available, not found, etc...

We have English and Croatian store. When you try to open (while on Croatian store) for example this url it will be a 404 page.

Switch to English store: it works fine.

Anyone having idea what to do?

PS. Client don't want store code in URL

2

2 Answers

1
votes

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
0
votes

Your 2 language websites are on the same domain name. This is causing problem.

You can :

use 1 subdomain per language or make the default language/store to english or make something more precise, like filtering user by origin (if you come from a search engine and you have an english url then go to english store).

etc.