I know this question may have been previously asked but I followed many reference links, but I cannot do this thing so please help me achieve it.
base URL = http://127.0.0.1/magento22/
1) Create a site in Magento with 4 languages
- Deutschland (German)
- Francais (French)
- Nederland (Dutch)
- Switzerland (Swiss)
2) Change code in index.php
<?php
/**
* Application entry point
*
* Example - run a particular store or website:
* --------------------------------------------
* require __DIR__ . '/app/bootstrap.php';
* $params = $_SERVER;
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
* $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
* \/** @var \Magento\Framework\App\Http $app *\/
* $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
* $bootstrap->run($app);
* --------------------------------------------
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
try {
require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
<h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
Autoload error</h3>
</div>
<p>{$e->getMessage()}</p>
</div>
HTML;
exit(1);
}
$params = $_SERVER;
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
switch ($actual_link)
{
case 'http://127.0.0.1/magento22/deutschland/':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'deutschland';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
case 'http://127.0.0.1/magento22/france/':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'france';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
echo "11";
break;
case 'http://127.0.0.1/magento22/nederland/':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'nederland';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
case 'http://127.0.0.1/magento22/switzerland/':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'switzerland';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
case 'http://127.0.0.1/magento22/':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'base';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
default:
$params = $_SERVER;
break;
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
$bootstrap->run($app);