1

I created a multi stores magento setup on 2 subdomains:

  • domain1.example.com (contains magento 2 files)
  • domain2.example.com (alias)

I aliased the domain2 to domain1 and redirect to the correct store based on domain name in the index.php on domain1 as done here.

I setup the correct BaseURLS and everything seems to work.

When I was testing a product and added the product to the 2nd store it would show everything except for the image.

On closer inspection the 2nd store cannot seem to find (404 errors) anything in the /pub/media folder (this includes styles.css and the images in the customer folder):

enter image description here Everything in the /pub/static will load fine!

I did some more testing and basically it's based on the filetype:

I uploaded some test files:

  • domain1.example.com/pub/media/test.txt -> works
  • domain2.example.com/pub/media/test.txt -> works

  • domain1.example.com/pub/media/test.png -> works

  • domain2.example.com/pub/media/test.png -> NOT WORKING: 404-error

  • domain1.example.com/pub/media/test.css -> works

  • domain2.example.com/pub/media/test.css -> NOT WORKING: 404-error

So it seems something goes wrong with rewriting, but I cannot seem to find the source.

I tried deploying, resfreshing and recaching etc. Tried changing permissions (but shouldn't make difference if other filetypes DO work). Tried deleting the .htaccess, no difference.

Been trying to figure it our for almost a day now, any help would be greatly appreciated!

UPDATE: Using the first domains MEDIA folder in the Store configuration fixes the issue!

0

Using the first domains MEDIA folder in the Store configuration fixes the issue!

  • Please add things in more detail, so other users can also benefit from this post. – Vivek Kumar Oct 4 '18 at 22:39

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.