1

I created a new storeview accessible under the URL app.example.com

I added this to the .htaccess to set the MAGE_RUN_CODE Environment Variable to app if the URL app.example.com is called:

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

Then I changed the base url of my new store view to http://app.example.com/

Problem:

I created a new CMS page for the new storeview with the URL Key app-test. But if I try to access it via app.example.com/app-test, then I get redirected to https://www.example.com/catalogsearch/result/?q=app+test

I tried to reindex and flush cache, but it made no difference.

0

1 Answer 1

1

I figured it out. The problem is, that my domain points to the pub folder, but I added my code to the .htaccess in the root directory of magento.

After I moved my code to pub/.htaccess, it works.


If this does not work, then try to delete your cookies too.

1
  • keep the code inside <IfModule mod_rewrite.c> Apr 13, 2023 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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