1

I'm struggling to get my magento2 website set up on different domains for each storeview and was wondering whether anyone could please advise how I can get this working?

I've created my store views for each language and have changed my Base URL within the store configuration for each to be correct domain.

I've also added the following SetEnvIf Host within my .htaccess file however visiting each store domain it redirects me back to my default store view?

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on

    SetEnvIf Host .*staging.autosmart.fr.* MAGE_RUN_CODE=fr
    SetEnvIf Host .*staging.autosmart.fr.* MAGE_RUN_TYPE=website

    SetEnvIf Host .*staging.autosmart.de.* MAGE_RUN_CODE=de
    SetEnvIf Host .*staging.autosmart.de.* MAGE_RUN_TYPE=website

    SetEnvIf Host .*staging.autosmart.nl.* MAGE_RUN_CODE=nl
    SetEnvIf Host .*staging.autosmart.nl.* MAGE_RUN_TYPE=website

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
</IfModule>

How can I get different domains for each store view?

0

You need to set the MAGE_RUN_TYPE to store, not to website here.

See http://devdocs.magento.com/guides/v2.1/config-guide/multi-site/ms_over.html

Also you have an extra whitespace after your Host name .* (beetween . and *). You can even remove this, as Host doesn't contain Uri anyway

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.