I created a new store view with code 'fr'. I have changed the base Url of that store view to 'http://127.0.0.1/magento/fr/'. I created the new folder with name 'fr' and copied .htaccess file and index.php inside it. Now I changed index.php like below:
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'fr';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store';
$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);
Now when I am hitting 'http://127.0.0.1/magento/fr/' it's showing the default store view instead of store view with code 'fr'. Can anyone tell what's wrong with the procedure ? Thanks!