Magento 2 – Redirect Static and Media URLs

configurationmagento2mediastatic-contenturl-rewrite

So what i want to do is have domain.com as a main domain. static.domain.com (that uses the files of domain.com) as my static view url and media.domain.com (that also uses the files of domain.com) for all my media files.

Now everything seems to work on the DNS side of things.

If i would go to static.domain.com/path/to/css/file.css then this works fine and i see the css in the browser.

But if i would browse to domain.com suddenly static.domain.com/path/to/css/file.css becomes domain.com/path/to/css/ which ofcourse is not correct and i have a console full with 'not found'

Any idea why this is happening? What Magento settings can cause this? Anyone any experience with these kind of things?

Thanks in advance!

Update

This is an example :
Url static -> https://static.domain.com/frontend/vendor/theme/nl_NL/mage/calendar.css

Redirect -> 302 Found
Url it redirects too ->
https://domain.com/nl/frontend/Designit/Multistore/nl_NL/mage/?SID=j828jng8krgjjemm5n37hn5u32

Redirect -> 404 Not Found

Best Answer

If someone wants to fix this themself :

stores->configuration->general->web->auto-redirect to Base Url -> NO

This will not redirect it to my problem stated above

Related Topic