Short and long URLs on Magento 2 - Canonical URLs difference

wood1e2

Free Member
May 2, 2007
2,313
174
Leicester
Hi

I have a general question about short product URLs. - ie no category or sub category and Long product URLs - product URLs in Magento 2.4

We have set up everything to be long URL so all product URL are www.mydomain.com/category/sub-category/product-name/

But it seems on M2 the Canonical URLs are alway, the short URL. From reading Adobe Commerce information that is correct!!

Why would this be? Surely we would want the Long URL as the Canoncial URL?

Unless of course what Adobe is saying, in a roundabout way, you don't want the Long URLs for SEO, just for customer awareness, and so multiple cateogry products are not duplicated.... therefore we stick with Canonical being the short URL, no matter what you do with the public facing URL?

Is this correct?
 

Solve My Problem

Free Member
Jul 16, 2021
404
166
Essex
Typically it's best practice to point just to the product to stop duplicate content issues with the same product being in different categories.

Google is smart enough to take into account of the category the product is found in, especially with a known platform such as Magento.

Product URLs are therefor important as well and should relate to the product (i.e. NOT t-shirt, but mens-white-short-sleeve-t-shirt

Googling bought up the following which you are probably already aware of having looked into it

The options used should be:-

In this Search Engine Optimization section, you’ll want to change the Use Canonical Link Meta Tag For Categories and Use Canonical Link Meta Tag For Products settings.

Clear Use system value and:

  • Set Use Canonical Link Meta Tag for Categories to Yes will generate canonical meta tags for your full category URLs.
E.g., http://example.com/women/tops-women/hoodies-and-sweatshirts-women.html

  • Set Use Canonical Link Meta Tag For Products to Yes will generate meta tag for all your product URLs. The canonical link will point to the short form of product URLs.
E.g., http://example.com/lifelong-fitness-iv.html

The recommended best practice is to enable both of these settings. After you’re finished configuring, click on Save, refresh your cache and you should see the canonical meta tag appearing in all your product pages and your category pages.

Under Marketing>URL Rewrites> Set all products to have Redirect Type for: Permanent(301)
 
Upvote 0
I disagree with Magento's approach.

Instead products should be pathed in their respecting categories, what we do with our opencart seo plugin is select a "main category" which is used as the canonical, all other category paths a product resides in are canonical to the "main" category.

This is much better practice.

Magento sucks - essentially anyone coming from google goes to a flat page, no breadcrumb navigation of the categories or anything, that really sucks mate.
 
Upvote 0

antropy

Business Member
  • Business Listing
    Aug 2, 2010
    5,313
    1,099
    West Sussex, UK
    www.antropy.co.uk
    I disagree with Magento's approach.

    Instead products should be pathed in their respecting categories, what we do with our opencart seo plugin is select a "main category" which is used as the canonical, all other category paths a product resides in are canonical to the "main" category.

    This is much better practice.

    Magento sucks - essentially anyone coming from google goes to a flat page, no breadcrumb navigation of the categories or anything, that really sucks mate.
    Agree with all this.

    Paul.
     
    • Like
    Reactions: WebDesires
    Upvote 0

    wood1e2

    Free Member
    May 2, 2007
    2,313
    174
    Leicester
    Hi

    Many thanks for the input

    @Solve My Problem - Thank you for confirming M2 functionality on this.

    That leaves the question if I am using long product URLs then surely the caonical being the short product URL ruins the SEO?

    Surely having the total opposite URL for Canonical defeats the reason for having long product URLs?

    Add to this M2 creates a brand new URL for each product based on the category/sub-category it is in, therefore generating duplicate content, as there will be

    /category/product-name
    /category/sub-category/product-name
    /category/sub-category/sub-category/product-name
    Plus the short verion /product-name

    we are left we four URLs for the same product. So I can see why by default m2 always uses the short product for Canonical to remove the duplication that is created by its own category system, but this is no good when we want to use long product URLs.

    @WebDesires and @antropy - I think you may be right, about M2.

    And same as Open Cart, WooCommerce/Yoast offers a 'Primart Category' so you can have 1 products in 1000's of catgegories, if that was your thing!! Anyway, the Canonical URL would be whatever the 'primary URL' was.

    Part of the reason for this post was just to see if I was misunderstanding M2 default position... not seeing the wood for the trees etc... But I suspect not .. now

    Also even if you select long product URLs in M2 feeds will still use short URL only, and some Sitemap plugins cannot generate with long urls, unless I re-code!!

    Which is a bore and sort of confirms my thoughts!
     
    Upvote 0

    Latest Articles