5

I'm trying to leave just one type of URL for product pages, it looks like this:

http://example.com/category/subcategory/product-name

But Magento automatically creates two more:

http://example.com/product-name
http://example.com/category/product-name

How to prevent this?

enter image description here

I tried truncating core_url_rewrite table and reindexing catalog, but it doesn't help.

(question continues my previous thread in which I've found how to make desired URL type default one)

2 Answers 2

5

You can prevent these paths from being generated in the first place - there's a setting in the admin:

System > Configuration > Catalog > Catalog > Use Categories Path for Product URLs:

Set this to No. A reindex of core_url_rewrite table should remove any unwanted urls.

Warning: This will remove all of the category names from all URLs, leaving only the base URL key. There's no way that I'm aware of to perform the opposite - provide only the deepest-depth URL as the canonical URL.

enter image description here

Magento creates these 'pages' by default in the site root and in all relevant categories to provide logical directory structure of product pages within any category as well as standalone pages in the site root.

My suggestion: leave them enabled.

Having descriptive URLs to If you're concerned about duplicate content, you shouldn't be. You should instead enable the setting to display canonical meta tags - this will notify search engines which of the multiple pages you consider to be the de-facto standard page, which all other duplicate product pages are based on.

Below the option as displayed above in the admin is the option to enable canonicals.

1
  • Thank you. If I set "Use Categories Path for Product URL" to no and then reindex everything - it still creates URL rewrite for each subcategory. I'm more concerned of crawl budget, as I already have a bunch of pages due to faceted navigation, duplicate content is not a problem.
    – Marvin3
    Commented May 29, 2013 at 5:33
0

Same as this one. Or you can write custom code to remove duplicated references.

1
  • Thanks! I wish I knew where to change the code to remove duplicate references :)
    – Marvin3
    Commented May 30, 2013 at 8:37

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.