title: Magento 1.7 SEO friendly URLs and multi store views
body: <p>Magento has fields for a Product and Category to create custom SEO friendly URL keys. 
  But when you have multiple stores, then you cannot normally have different URL keys 
  for different stores because the field url_key is ‘GLOBAL’ by default. For products, 
  you can update the url_key attribute’s is_default field to ‘Store Views‘ from Attribute 
  Management. But for the category’s url_key field, you don’t have that option in Magento. 
  But the field does exist in the database with the same attribute code but having different 
  backend_model so you need to go to the database directly and change the ‘is_global’ field 1 to 0.</p>
  
  <p>reference: <a href="http://www.devraju.com/magento/different-category-url-keys-for-different-store-views-in-magento/" rel="nofollow noreferrer">http://www.devraju.com/magento/different-category-url-keys-for-different-store-views-in-magento/</a>
  see comments on the bottom of the page. </p>
  
  <p>same issue here:
  <a href="https://stackoverflow.com/questions/9096622/magento-multilanguage-double-change-in-language-resuts-in-404-or-how-to-chang">Magento multilanguage - double change in language resuts in 404 (or how to change language within stores not views)</a></p>
  
  <p>This strategy seems to work in older versions, but in 7.1 I am having trouble.  When I go to Catalog >> Attributes >> Manage Attributes, the url_key attribute is already set to store view.  See image below.</p>
  
  <p><img src="https://i.stack.imgur.com/Htrgm.jpg" alt="enter image description here"></p>
  
  <p>Furthermore the attribute table looks properly configured. See SQL below.</p>
  
  <p>The Switching code looks like this:</p>
  
  <pre><code>    &lt;?php if(count($this-&gt;getStores())&gt;1): ?&gt;
      &lt;div class="form-language"&gt;
          &lt;label for="select-language"&gt;&lt;?php echo $this-&gt;__('Your Language:') ?&gt;&lt;/label&gt;
          &lt;select id="select-language" title="&lt;?php echo $this-&gt;__('Your Language') ?&gt;" onchange="window.location.href=this.value"&gt;
          &lt;?php foreach ($this-&gt;getStores() as $_lang): ?&gt;
              &lt;?php $_selected = ($_lang-&gt;getId() == $this-&gt;getCurrentStoreId()) ? ' selected="selected"' : '' ?&gt;
              &lt;option value="&lt;?php echo $_lang-&gt;getCurrentUrl() ?&gt;"&lt;?php echo $_selected ?&gt;&gt;&lt;?php echo $this-&gt;htmlEscape($_lang-&gt;getName()) ?&gt;&lt;/option&gt;
          &lt;?php endforeach; ?&gt;
          &lt;/select&gt;
      &lt;/div&gt;
      &lt;?php endif; ?&gt;        
  </code></pre>
  
  <p>SQLs</p>
  
  <pre><code>SELECT * FROM eav_attribute WHERE attribute_code LIKE '%url_key%';  
  
  attribute_id Attribute Id   entity_type_id Entity Type Id   attribute_code Attribute 
      Edit    Delete  43  3   url_key  catalog/category_attribute_backend_urlkey  
      Edit    Delete  97  4   url_key  catalog/product_attribute_backend_urlkey  
  
  
  SELECT attribute_id, is_global FROM catalog_eav_attribute WHERE attribute_id=43;
  SELECT attribute_id, is_global FROM catalog_eav_attribute WHERE attribute_id=97;
  
  
  Full Texts  attribute_id Attribute ID   is_global Is Global
      Edit    Delete  43  0
  
  
  Full Texts  attribute_id Attribute ID   is_global Is Global
      Edit    Delete  97  0
  </code></pre>
  
  <p>I also tried to solve it using re-write rules, but re-write rules do not seem to cover language switching. ref: <a href="http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index" rel="nofollow noreferrer">http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index</a></p>
  
  <p>i am looking for solution with appropriate code modifications.</p>