I created a new store view with code 'fr'. I have changed the base Url of that store view to ''. 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);

Now when I am hitting '' 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. Jun 18, 2018 at 9:26
  • Aur kitni reputation chahiye bhai ?
    – mighty_hk
    Jun 18, 2018 at 9:57

1 Answer 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 and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.