Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dharmesh-tukadiya opened this issue Jan 10, 2025 · 0 comments

Comments

@dharmesh-tukadiya
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant