Skip to content

How to include category url keys in product URLs

I am preparing to get Magento certified, doing some test questions I have found this:

A client has asked you to include category url keys in product URLs.
How is this done?

A. Create an observer for controller_action_postdispatch_catalog_product_view
B. This is not possible because products can belong to multiple categories
C. Set the configuration value of catalog/seo/product_use_categories to Yes
D. Create an after plugin on MagentoUrlRewriteControllerRouter::generateRewrite

The answer marked as correct is D but I think the correct answer is C.

Can someone give me their opinion on this?

Thanks in advance.