Answer the question
In order to leave comments, you need to log in
How to make a canonical link for the full path to a product in Magento?
A lot of discussions, but I did not find the answer to my question.
The same product is available at the following addresses:
1) domain/category/subcategory/product-page
2) domain/category/product-age
3) domain/product-
page canonical link #3. But I need link 1 to be canonical.
Or do it without canonicals at all and put 404 on all pages except the first one.
If there is no specific solution, then at least tell me, in the direction of which modules / functions inside Magento should I look for a solution?
Answer the question
In order to leave comments, you need to log in
The link for the canonical tag is pulled from the getUrl function, so it is always different, because it depends on how the user got to this page.
I can advise the following:
1) bring all links to the same form, regardless of the path to the page. To do this, use another function: getCurrentUrl.
2) Disable the generation of the canonical link for the catalog in the settings in SYSTEM> CONFIG> Catalog> Search engine optimization (SEO) --- Use Canonical Link Meta Tag For Categories (set to NO).
3) generate a canonical link through the layout file app\design\frontend\PACKAGE\THEME\layout\local.xml
For example, by default, for all pages using the getCurrentUrl function:
<default>
<reference name="head">
<action method="addLinkRel">
<rel>canonical</rel>
<href helper="core/url/getCurrentUrl"/>
</action>
</reference>
</default>
<catalog_category_layered></catalog_category_layered>
etc. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question