Description
Description
When updating category URL keys via REST API there is no possibility to automatically create 301 redirects for the old URL key to the new one.
For products this is possible
Expected behavior (*)
contents of category-rename.json
{"category":{"name":"new name","is_active":1,"parentId":2366,"custom_attributes":[{"attribute_code":"url_key","value":"new name"},{"attribute_code":"save_rewrites_history","value":1}]}}
When making a API call like
curl -k -X PUT $BASEURL/rest/V1/categories/1295 -H 'Content-Type: application/json' -H "Authorization: Bearer $BEARER" -d @category-rename.json
I expect that a new entry is created a the end of url_rewrite
database table with the old url_key redirecting to the new category.
Instead, after the API call, I cannot find the URL key anywhere in the url_rewrite
table.
Benefits
There are shops which are managed by PIM systems via API. Here it is important for SEO reasons, to allow renaming the URL key without loosing old links.
Additional information
There was already a pull request implementing something similar, but without the option to not create rewrites.
#18408
The save_rewrites_history
is supported for products. So for consistency this should also be possible for categories.
Maybe I can be implemented similarly to \Magento\CatalogUrlRewrite\Plugin\Webapi\Controller\Rest\InputParamsResolver::afterResolve
Metadata
Metadata
Assignees
Labels
Type
Projects
Status