By default the Magento XML sitemap and canonical URL features ignore categories and write all URLS as


It appears that these features can't use categories because a product can be under more than one category. However, a product can only be under one attribute set, and it just so happens that my attribute sets line up pretty well with my base level categories so I was wondering what changes I would need to make to get Magento to use attribute sets in the XML sitemap and canonical URL tags? For example, if product "Model1A" was of attribute set "Foo", I would like the XML sitemap and canonical URL to show:


I've been looking around for a bit but could not find a straight forward explanation about this. I suppose for the canonical URLs I could disable the feature and edit a phtml template to include the tag manually the way I want to build it, but I'm particularly lost when it comes to changing how the XML sitemap is generated. Any suggestions?

  • How is it even possible that you replied that fast? =p Thanks I'll take a look at this link! – Joe M. Mar 18 '13 at 17:19
  • Cut & paste helps. ;) – John Conde Mar 18 '13 at 17:20
  • Well no luck here I wonder if I could get this post moved to the magento SE site? – Joe M. Mar 25 '13 at 21:22
  • Flag it and the mods will do that for you – John Conde Mar 25 '13 at 21:25
  • 1
    I don't think this can be done easily, but can you give more details about why do you want this? The product URL is unique anyway. What's the problem if you generate the sitemap with mysite.com/product ? – Marius Mar 26 '13 at 13:27

You can change your Magento product URL and attribute set by two ways.

  1. Either you can handle product save event and modify the URL
  2. You can go to Catalog->URL Rewrite and change the specific URLS. This may not be suitable for your case.
  • can you give an example for observer which modifies the product url after save event? – Shathish Aug 29 '13 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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