Skip to content

Give an Option To Create Permanent URL Redirect 301 While Chosing Option --save-old-urls #174

Open
@dharmesh-tukadiya

Description

@dharmesh-tukadiya

Summary

Hello, I just wanted to request a little feature to have the option while choosing --save-old-urls option to set whether create 301 /302 Redirect.

Basic example

Let's say in Magento backend, When you have 2 store views french and english and both have different product names in each languages, Now I've set url key at global level, say abc.html. Note, English and french both have different domain names and the urls english.com/abc.html and french.com/abc.html already on the google.

Now I want to set new url key for english say, english.com/en-abc.html & french.com/fr-abc.html
For this to achieve in magento backend, I'll change product name in english store to be En Abc & For French Fr Abc, after which I go to Search Engine optimization tab and untick, Use Config Value for url key and make url key value to be empty and save the product. This way, What magento does is that, It'll create a new url, english.com/en-abc.html and french.com/fr-abc.html & a 301 permanent redirect for the old url english.com/abc.html and french.com/abc.html

So, The new urls will be submitted to the xml sitemap and google will index it, but what for the older one that already exist on the google? So Magento will redirect the user to the english.com/abc.html to english.com/en-abc.html & same for french.

I've tried below command and checked the README.md and code too! But i could not find this above functionality that magento backend provides in your module and I think It's critical.

php bin/magento ok:urlrewrites:regenerate --entity-type=product --product-id=41 --store-id=2 --save-old-urls --no-reindex

FYI, I used above command.

This command create new url for sure but not creating 301/302 with the old url.

Thanks,
Dharmesh Tukadiya.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions