0

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!

  • Happy coding :) @mighty_hk. You can upvote on this answer so other user can use this answer for their solution. – Rohan Hapani Jun 18 '18 at 9:26
  • Aur kitni reputation chahiye bhai ? – mighty_hk Jun 18 '18 at 9:57
1

Follow this step to add store code in url :

  • In the Admin, click Stores > Settings > Configuration > General > Web.
  • From the Store View list at the top of the page, click Default Config as the following figure shows.
  • In the right pane, expand Url Options.
  • Clear the Use system value checkbox next to Add Store Code to Urls.
  • From the Add Store Code to Urls list, click Yes as the following figure shows.
  • Click Save Config.
  • Flush the Magento cache. (System > Cache Management).

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.