canonical url

  • Posts: 36
  • Thank you received: 1
  • Hikashop Business
1 day 8 hours ago #373040

-- HikaShop version -- : 6.5
-- Joomla version -- : 3.10

I moved some categories around and sub to others or split them out.
Discovered in doing so the canonical url that was first set now is wrong and it goes to a error page for most products which it was set in those categories.

What apart from deleting each product canonical url link which would take a lot of time can I delete the link in the categories I moved on mass so they get recreated automatically when visited on the front end as normal.

Please Log in or Create an account to join the conversation.

  • Posts: 86042
  • Thank you received: 14174
  • MODERATOR
1 day 3 hours ago #373042

Hi,

You can do that in one go with a mass action.

Go in the menu System > Mass actions of HikaShop and create a new mass action with :

- Table : products
- Filter : add a filter on the "category" table and select the categories you moved, so that only the products of these categories are processed. If all the canonical URLs of your products were generated automatically anyway, you can simply add no filter at all and process all the products.
- Action : "Set canonical url", and leave its text field completely empty.

Then save and run the mass action. That action writes the value you enter in the canonical URL field of each product matching the filter, so with an empty value it just empties them all.

After that, since your setting "Force canonical URLs on listings" is set to "Use canonical URL and generate it if missing", HikaShop will store a new canonical URL on each product, based on your new category structure, the next time the page of the product is displayed on the front end.

One thing which is worth knowing, and which explains the error pages you see : that stored canonical URL is not only used for the canonical tag in the head of the page, it is also used to build the links to the products in the product listings. So as long as a product keeps an obsolete canonical URL, the link to that product in your listings points to the obsolete URL too. Emptying the field fixes both at once.

If the categories themselves also have an obsolete canonical URL, you can do the same with a second mass action on the table "categories", with the action "Update values", the column "category_canonical" and an empty value.

Finally, to avoid the situation happening again the next time you reorganize your categories, you can set "Force canonical URLs on listings" to "Use canonical URL if specified" in the configuration (tab Features, section "SEF URL options"). With that setting, HikaShop still adds a canonical tag on the pages, but it generates it from the current URL of the page instead of storing it in the database, so it always follows your current category structure. Only the canonical URLs you type yourself in the SEO area of a product are then used. Note also that with your current setting, the URL which gets stored is the first URL a visitor happened to use to reach the product, which is not necessarily the one you would have chosen.

The following user(s) said Thank You: dailybread

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum