0

I created a new store view with code app.

I made a new subdomain for it called app.example.com, if this Url ist getting loaded, then the MAGE_RUN_CODE changes to app, otherwise it is default.

.htaccess:

SetEnv MAGE_RUN_TYPE store
SetEnvIf Host ^example.com MAGE_RUN_CODE=default
SetEnvIf Host ^www.example.com MAGE_RUN_CODE=default

SetEnvIf Host ^app.example.com MAGE_RUN_CODE=app
SetEnvIf Host ^www.app.example.com MAGE_RUN_CODE=app

It works fine, but if I access categories then I get redirected to the search site as a fallback because the site cant be found.

I figured out that the URL rewrites for the storeview are missing.

For example we have this site:

www.example.com/products/banana

But if I try to load it with the new store view

https://app.example.com/products/banana

then it can't get found.

I can only access it like this:

https://app.example.com/catalog/category/view/s/banana/id/10/

We solved it with URL rewrites to make it accessible with /products/banana instead of that long catalog/category/view/s/banana/id/10/ path. However, these URL rewrites are only valid for the default store view, I can't change it to "all store views*

Question:

Do we have to create each URL Rewrite by hand again or is there a fast way to just clone the old ones and reuse them for the new app store view?

1 Answer 1

1

There is two things that I know can be done. First you can go in the admin in the category section in the specific store view and save categories to regenerate urls.

Second, Magento url rewrites can cause a lot of headache, so i would suggest you to use this free extension to regenerate your urls rewrite : https://github.com/olegkoval/magento2-regenerate_url_rewrites. Make sure to regenerate url for each store and not only the default store by using the param --store-id in your console command.


Edit by Black:

I had to use this command:

php bin/magento ok:urlrewrites:regenerate --entity-type=category
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.