I wonder if it is possible to use a DOT (.) in a product URL in Magento. I want to create a product URL that looks something like this:


But when I try to do this then after saving the product the DOT in 10.1 is automatically changed in a DASH (-) and the URL becomes:


I have seen other websites that have DOTs in the path part of their URLs. I'm not sure why Magento doesn't accept them.

Any thoughts are welcome!

  • For anyone: To use DOTs in category URLs I used the same solution provided by @Marius below, and applied it to the method Mage_Catalog_Model_Category::formatUrlKey()
    – MatthijsIJ
    May 7, 2014 at 14:34

2 Answers 2


You need to rewrite this method: Mage_Catalog_Model_Product_Url::formatUrlKey().
You need to change this line:

$urlKey = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($str));

What this basically means is, 'replace anything that's not alphanumeric with -'.
You need to make it allow dots also. Just add a dot in the regular expression. #[^0-9a-z\.]+#i
(not sure if it should be escaped \. - test them both).
Seams like it should be escaped.
Thanks @FabianBlechschmidt for the crash course in regex.

  • 2
    It should be escaped, because . is everything. If you want the dot \. is the right regex May 7, 2014 at 13:28
  • @FabianBlechschmidt. Thanks for the correction. I changed the answer.
    – Marius
    May 7, 2014 at 13:30
  • Using the \. works like a charm, thanks guys!!
    – MatthijsIJ
    May 7, 2014 at 13:45
  • There was an edit suggestion on the answer proposed by an anonymous user that I rejected because it seamed to change a lot of of the answer. It may be useful because I'm lousy at regex. This was it. "(. does not need escaping inside a character class. It only has meaning outside of [])"
    – Marius
    May 7, 2014 at 14:40
  • The edit seems to be correct. Note tested with code but I did put the regex into regexr.com and it appears to match either way. May 7, 2014 at 14:43

Not Sure if this fulfill your requirement, Magento has feature to manage url for products

Refer to Creating Url Rewrites

  • I was looking for the answer provided by @Marius. But thanks anyway!!
    – MatthijsIJ
    May 7, 2014 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.