Automatic Redirects when changing product slug

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
AugustAce
Posts: 2
Joined: 18 Apr 2023, 12:17

Automatic Redirects when changing product slug

Post by AugustAce » 18 Apr 2023, 12:24

Hi,

I am new to Aimeos, so bear with me, but when I change the url slug of a product, the old slug gives a 404 error. Is there a setting I can change so the old url slug would 301 redirect to the new slug?

I know the product urls shouldn't really change once established but I was thinking if an admin user changed one, for example, if they noticed a spelling was incorrect, then the page wouldn't lose the SEO benefit it had gained.

Thanks

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Automatic Redirects when changing product slug

Post by aimeos » 19 Apr 2023, 09:09

There's no such feature yet. The easiest way to implement that would be to add two URL segments (old and new) in the text subpart of the product panel because they overwrite the product slug. To make that work, these lines have to be modified to add one record for each slug:
https://github.com/aimeos/aimeos-core/b ... #L719-L791
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

AugustAce
Posts: 2
Joined: 18 Apr 2023, 12:17

Re: Automatic Redirects when changing product slug

Post by AugustAce » 22 Apr 2023, 22:04

Thank you for the reply but I’m not sure if this solution would work, for example, if the slug was changed a third time, the first two urls would now need redirecting to the new third one. I may have misunderstood what your suggested solution though.

When updating a product or category is an event fired? I know Laravel has model events, which fire when updating a model but not sure if you’re software is using Laravel models to save data etc.

Post Reply