0

I'm using SetEnvIf Host to redirect users to the correct magento store depending on the domain name. This works perfect for https://www.domain.co.uk, http://domain.co.uk and http://www.domain.co.uk.

https://domainname.co.uk however bypasses this and redirects to the main store.

here is what i have in the htaccess in the pub folder of the magento 2 system.

SetEnvIf Host ^.*domainname\.co\.uk MAGE_RUN_CODE=uk
SetEnvIf Host ^.*domainname\.co\.uk MAGE_RUN_TYPE=store

Is there something wrong with this code?

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
  • Those two directives simply set a couple of env vars if the requested `Host` header _contains_ "domainname.co.uk". If that is what they are meant to do then there is nothing particularly "wrong" with them. Have you confirmed whether these env vars are being set? These directives by themselves don't redirect anything - as you appear to suggest. What other directives do you have in `.htaccess`? Or do these env vars mean something to Magento and this is really a Magento question (off-topic on ServerFault)? – MrWhite Feb 17 '21 at 09:45
  • 1
    These vars are being set, and update the magento store, which redirects. I found the issue, it was unrelated. – Jonas de Herdt Feb 17 '21 at 14:00

0 Answers0