Howto short SEF urls (no cat or product)

  • Posts: 43
  • Thank you received: 3
5 years 5 months ago #300443

-- HikaShop version -- : 4.0.0
-- Joomla version -- : 3.9.0
-- PHP version -- : 7.2
-- Browser(s) name and version -- : chrome/firefox

Hello I have a multi-language site (en,fr) and would like to create really short urls to products:

french: domain.com/product_name
english: domain.com/en/product_name

I have gone through ++posts explaining how to add/remove the category and product parts of the url (even generating if not there etc.)...but I have found nothing which lets me exclude both the category & product.

I have tried adding the canonical url in the product, ex: /product_name1
But this gives me a 404: domain.com/product_name1

In HS settings I have toggled Force Canonical urls with "Use Canonical URL and generate if missing"

Do I need a SEO plugin in order to achieve those short urls?

Thanks

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
5 years 5 months ago #300450

Hi,

If you want to achieve such short URLs for both categories and products, yes, you need a SEF plugin which handle SEF aliases like does sh404SEF.
You can achieve URLs like domain.com/product_name1
However, this requires that the home page menu item of your website is a category or products listing menu item, and it requires the "product SEF name" to be empty, which will lead to the category SEF name not being empty.
That's because HikaShop's router has no caching.
It has to analyse the URL elements to be able to route the request to the correct controller.
SEF plugins which allow you to use whatever URL you want don't work like that. They need to store the correspondance between the URL that is dynamically generated and the URL that you want so that when the router of the SEF plugin has to do the conversion on the other way, it can look up into that cache.
While this gives a lot of flexibility, this also create issues because when the URL displayed has been removed from the cache (because the cache was purged for x reasons), you end up with invalid URLs and the cache has to be rebuilt.
And usually, such SEF caching mechanism is implemented at the website level and thus is outside the scope of what an extension routing system is supposed to handle and why you can't have whatever URL you want for whatever page of your website (with HikaShop, but with basically any other extension) unless you use such SEF extension.

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

  • Posts: 43
  • Thank you received: 3
5 years 4 months ago #301072

Ok Nicolas, ty.

I did try setting up JoomSef but it was difficult to get Joomla, Falang, Hika and Joomsef to play together. Nothing I tried would allow me to have those short, sexy urls.

But I did find a way to have a valid (technical solution):
I deleted all canonical urls
I switched to Use Canonical and Generate if missing.
(note: If I leave it at this...my submenus all point to bad links)
I went to the front end and displayed ALL products (generating the canonical urls)
Then I switched to "No, Generate the URLs".

...so now the canonical urls are valid (I tested them)...and I have no bad links. All works except the short urls (which is not a show stopper).

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
5 years 4 months ago #301082

Hi,

Yes, your steps are a good way to clean the invalid canonical URLs and avoid issues with 404 routing errors.
Then, to have shorter URLs, you would need a SEF alias system and add the URLs manually.
I'm not familiar with JoomSef so I wouldn't be able to say if that extension can do that, or even how as I've never used it.
Maybe they could help you set that up in the future to improve the URLs for your SEO.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum