Stratus Guides - Multistore Subfolder Configuration Method
If you would like to use the same domain, but use different stores per subfolder (such as /us, /ca, /fr, /en, etc.), you should use the subfolder method instead of the standard method for multistore configuration.
-
Create the desired folder within the
/pub/
directory in your root directory (for this example, we will use “en”).mkdir /srv/public_html/pub/en
-
Create the required symlinks within the new folder. Make sure they are absolute to prevent any issues with autoscaling. For example:
cd /srv/public_html/pub/en ln -s /srv/public_html/app app
Once completed, the `/en` directory should appear like this:
lrwxrwxrwx 1 www www 10 Mar 23 14:07 app -> /srv/public_html/app/
lrwxrwxrwx 1 www www 19 Mar 23 14:08 index.php -> /srv/public_html/pub/index.php
lrwxrwxrwx 1 www www 10 Mar 23 14:08 lib -> /srv/public_html/lib/
lrwxrwxrwx 1 www www 27 Mar 23 17:13 media -> /srv/public_html/pub/media/
lrwxrwxrwx 1 www www 28 Mar 23 17:13 static -> /srv/public_html/pub/static/
lrwxrwxrwx 1 www www 10 Mar 23 14:08 var -> /srv/public_html/var/
- Add the following code to the Nginx includes. Adjust the subfolder name, “/en”, in each occurence (7) to the actual subfolder you prefer, and the store code, “en_store_view”, in the one occurence.
`location /en/ { index index.php index.html index.htm; try_files $uri $uri/ /en/index.php?$args ; location ~* .php$ { expires off; fastcgi_pass php-fpm; fastcgi_keep_conn on; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE "en_store_view";
fastcgi_param MAGE_RUN_TYPE "store";
fastcgi_param UNIQUE_ID $connection.$connection_requests;
fastcgi_param HTTPS $http_x_ssl_offloaded if_not_empty;
}
location ~ ^/en/static/version {
rewrite ^/en/static/(version\d*/)?(.*)$ /en/static/$2 last;
}
location /en/media/ {
try_files $uri $uri/ /get.php$is_args$args;
location ~ ^/en/media/theme_customization/.*\.xml {
deny all;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
add_header Cache-Control "public";
add_header X-Frame-Options "SAMEORIGIN";
expires +1y;
try_files $uri $uri/ /get.php$is_args$args;
}
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
add_header Cache-Control "no-store";
add_header X-Frame-Options "SAMEORIGIN";
expires off;
try_files $uri $uri/ /get.php$is_args$args;
}
add_header X-Frame-Options "SAMEORIGIN";
}
}
Feedback
Was this page helpful?
Glad to hear it! Have any more feedback? Please share it here.
Sorry to hear that. Have any more feedback? Please share it here.
Last modified January 1, 0001