3 added 126 characters in body
source | link

This answer can also be found in the Experius Codeblog

https://codeblog.experius.nl/magento-2-storeview-subdirectory/

You could run the second store in a subdirectory and depending on your server (NGINX or apache) how you can configure this.

Follow the following instructions:

Disable Store Code in URL

This Configuration setting has to be disabled to be able to use subdirectories.

Stores > Settings > Configuration > General > Web > Url Options > Add Store Code to URLS

Configure Base URL

Foreach Base URL you have to add the subfolder at the end

For example

Global: http://example.com/

Dutch storeview: http://example.com/nl/

French storeview: http://example.com/fr/

Create Subfolders

Create a Subfolder foreach different storeview, for which you configured the new base url, in the pub folder. This is because all request for each stroeview ill go through this folder.

Example:

mkdir ~/[pathToMagentoRoot]/pub/nl

mkdir ~/[pathToMagentoRoot]/pub/fr

Create Symlinks in the subfolder to the media, static, opt and errors folders. This is necessary to correctly load the media and theme files.

For example:

cd ~/[pathToMagentoRoot]/pub/fr ln -s ../media media

ln -s ../static static

ln -s ../opt opt

ln -s ../errors errors

Copy the index.php and .htaccess

Now you only have to copy the index.php and .htaccess from the pub folder and edit these according to the entry points.

For example:

In the index.php change the following sentence:

require realpath(DIR) . '/../app/bootstrap.php';

to

require realpath(DIR) . '/../../app/bootstrap.php';

Then edit .htaccess (only when you are running on an apache server). In this example there is only an explanation for nginx.

Nginx rewrite foreach Storeview Add the following block to your nginx configuration foreach storeview:

location /[storeviewfolder]/ {

index index.php index.html index.htm;

try_files $uri $uri/

/[storeviewfolder]/index.php?$args;

}

You could run the second store in a subdirectory and depending on your server (NGINX or apache) how you can configure this.

Follow the following instructions:

Disable Store Code in URL

This Configuration setting has to be disabled to be able to use subdirectories.

Stores > Settings > Configuration > General > Web > Url Options > Add Store Code to URLS

Configure Base URL

Foreach Base URL you have to add the subfolder at the end

For example

Global: http://example.com/

Dutch storeview: http://example.com/nl/

French storeview: http://example.com/fr/

Create Subfolders

Create a Subfolder foreach different storeview, for which you configured the new base url, in the pub folder. This is because all request for each stroeview ill go through this folder.

Example:

mkdir ~/[pathToMagentoRoot]/pub/nl

mkdir ~/[pathToMagentoRoot]/pub/fr

Create Symlinks in the subfolder to the media, static, opt and errors folders. This is necessary to correctly load the media and theme files.

For example:

cd ~/[pathToMagentoRoot]/pub/fr ln -s ../media media

ln -s ../static static

ln -s ../opt opt

ln -s ../errors errors

Copy the index.php and .htaccess

Now you only have to copy the index.php and .htaccess from the pub folder and edit these according to the entry points.

For example:

In the index.php change the following sentence:

require realpath(DIR) . '/../app/bootstrap.php';

to

require realpath(DIR) . '/../../app/bootstrap.php';

Then edit .htaccess (only when you are running on an apache server). In this example there is only an explanation for nginx.

Nginx rewrite foreach Storeview Add the following block to your nginx configuration foreach storeview:

location /[storeviewfolder]/ {

index index.php index.html index.htm;

try_files $uri $uri/

/[storeviewfolder]/index.php?$args;

}

This answer can also be found in the Experius Codeblog

https://codeblog.experius.nl/magento-2-storeview-subdirectory/

You could run the second store in a subdirectory and depending on your server (NGINX or apache) how you can configure this.

Follow the following instructions:

Disable Store Code in URL

This Configuration setting has to be disabled to be able to use subdirectories.

Stores > Settings > Configuration > General > Web > Url Options > Add Store Code to URLS

Configure Base URL

Foreach Base URL you have to add the subfolder at the end

For example

Global: http://example.com/

Dutch storeview: http://example.com/nl/

French storeview: http://example.com/fr/

Create Subfolders

Create a Subfolder foreach different storeview, for which you configured the new base url, in the pub folder. This is because all request for each stroeview ill go through this folder.

Example:

mkdir ~/[pathToMagentoRoot]/pub/nl

mkdir ~/[pathToMagentoRoot]/pub/fr

Create Symlinks in the subfolder to the media, static, opt and errors folders. This is necessary to correctly load the media and theme files.

For example:

cd ~/[pathToMagentoRoot]/pub/fr ln -s ../media media

ln -s ../static static

ln -s ../opt opt

ln -s ../errors errors

Copy the index.php and .htaccess

Now you only have to copy the index.php and .htaccess from the pub folder and edit these according to the entry points.

For example:

In the index.php change the following sentence:

require realpath(DIR) . '/../app/bootstrap.php';

to

require realpath(DIR) . '/../../app/bootstrap.php';

Then edit .htaccess (only when you are running on an apache server). In this example there is only an explanation for nginx.

Nginx rewrite foreach Storeview Add the following block to your nginx configuration foreach storeview:

location /[storeviewfolder]/ {

index index.php index.html index.htm;

try_files $uri $uri/

/[storeviewfolder]/index.php?$args;

}
2 added 1815 characters in body
source | link

You could run the second store in a subdirectory and depending on your server (NGINX or apache) how you can configure this.

Let me know ifFollow the following instructions:

Disable Store Code in URL

This Configuration setting has to be disabled to be able to use subdirectories.

Stores > Settings > Configuration > General > Web > Url Options > Add Store Code to URLS

Configure Base URL

Foreach Base URL you need any help configuringhave to add the subdirectory!subfolder at the end

For example

Global: http://example.com/

Dutch storeview: http://example.com/nl/

French storeview: http://example.com/fr/

Create Subfolders

Create a Subfolder foreach different storeview, for which you configured the new base url, in the pub folder. This is because all request for each stroeview ill go through this folder.

Example:

mkdir ~/[pathToMagentoRoot]/pub/nl

mkdir ~/[pathToMagentoRoot]/pub/fr

Create Symlinks in the subfolder to the media, static, opt and errors folders. This is necessary to correctly load the media and theme files.

For example:

cd ~/[pathToMagentoRoot]/pub/fr ln -s ../media media

ln -s ../static static

ln -s ../opt opt

ln -s ../errors errors

Copy the index.php and .htaccess

Now you only have to copy the index.php and .htaccess from the pub folder and edit these according to the entry points.

For example:

In the index.php change the following sentence:

require realpath(DIR) . '/../app/bootstrap.php';

to

require realpath(DIR) . '/../../app/bootstrap.php';

Then edit .htaccess (only when you are running on an apache server). In this example there is only an explanation for nginx.

Nginx rewrite foreach Storeview Add the following block to your nginx configuration foreach storeview:

location /[storeviewfolder]/ {

index index.php index.html index.htm;

try_files $uri $uri/

/[storeviewfolder]/index.php?$args;

}

You could run the second store in a subdirectory and depending on your server (NGINX or apache) how you can configure this.

Let me know if you need any help configuring the subdirectory!

You could run the second store in a subdirectory and depending on your server (NGINX or apache) how you can configure this.

Follow the following instructions:

Disable Store Code in URL

This Configuration setting has to be disabled to be able to use subdirectories.

Stores > Settings > Configuration > General > Web > Url Options > Add Store Code to URLS

Configure Base URL

Foreach Base URL you have to add the subfolder at the end

For example

Global: http://example.com/

Dutch storeview: http://example.com/nl/

French storeview: http://example.com/fr/

Create Subfolders

Create a Subfolder foreach different storeview, for which you configured the new base url, in the pub folder. This is because all request for each stroeview ill go through this folder.

Example:

mkdir ~/[pathToMagentoRoot]/pub/nl

mkdir ~/[pathToMagentoRoot]/pub/fr

Create Symlinks in the subfolder to the media, static, opt and errors folders. This is necessary to correctly load the media and theme files.

For example:

cd ~/[pathToMagentoRoot]/pub/fr ln -s ../media media

ln -s ../static static

ln -s ../opt opt

ln -s ../errors errors

Copy the index.php and .htaccess

Now you only have to copy the index.php and .htaccess from the pub folder and edit these according to the entry points.

For example:

In the index.php change the following sentence:

require realpath(DIR) . '/../app/bootstrap.php';

to

require realpath(DIR) . '/../../app/bootstrap.php';

Then edit .htaccess (only when you are running on an apache server). In this example there is only an explanation for nginx.

Nginx rewrite foreach Storeview Add the following block to your nginx configuration foreach storeview:

location /[storeviewfolder]/ {

index index.php index.html index.htm;

try_files $uri $uri/

/[storeviewfolder]/index.php?$args;

}
1
source | link

You could run the second store in a subdirectory and depending on your server (NGINX or apache) how you can configure this.

Let me know if you need any help configuring the subdirectory!