URL Key characters conversion
Product URL Key |
Product URL Key is prepared in catalog/product_url model in formatUrlKey method, in the following sequence:
- // convert non-alphanumeric characters
- // - see the rules below on the page
- Mage::helper('catalog/product_url')->format($urlKey);
- // replace remaining non-alphanumeric characters
- // with dashes
- preg_replace('#[^0-9a-z]+#i', '-', $urlKey);
- // make it lowercase
- strtolower($urlKey);
- // trim dashes on the left and right
- trim($urlKey, '-');
Non-alphanumeric characters conversion rules |
Non-alphanumeric characters conversion table is defined in Mage_Catalog module configuration file and can be overridden globally or per website/per store from within custom extensions config files or app/etc/local.xml.
- <config>
- ...
- <default>
- ...
- <url>
- <convert>
- ...
- <char0228><from>ä</from><to>a</to></char0228>
- ...
- <char0246><from>ö</from><to>o</to></char0246>
- ...
- <char0252><from>ü</from><to>u</to></char0252>
- ...
- </convert>
- </url>
- </default>
- </config>
By default it convert umlauts to single characters (ä → a, ö → o, ü → u). Below is how it can be overriden in app/etc/local.xml to make to convert to 2-character sequence (ä → ae, ö → oe, ü → ue). Add the following code right before closing </config> tag :
- <default>
- <url>
- <convert>
- <char0228><from>ä</from><to>ae</to></char0228>
- <char0246><from>ö</from><to>oe</to></char0246>
- <char0252><from>ü</from><to>ue</to></char0252>
- </convert>
- </url>
- </default>


