I have the following situation:

I have a multiple store views and for one of the store I have let's say this url:


What I try to do, is to change the base url to : www.myurl.com/something/ to be the default base url.

So all the pages should look like this: www.myurl.com/something/page

If I change this from Store -> Config -> General -> Web I receive a 404.

What is the best approach to do this thing?


I did like this for one website with multistore.




In Admin

Admin -> Store -> Configuration -> General -> Web(change store as storeone) -> base url & secure base url ->


Admin -> Store -> Configuration -> General -> Web(change store as storetwo) -> base url & secure base url ->


In magento root

Go to your magento root entry (in my case it is /var/www/html/), it may be /var/www/html/pub. Create a folder storeone. Copy file from <magento-root>/index.php and .htacces to storeone, then symlink to app, lib, var, pub. Repeat the same in storetwo.


cd `<magento-root-entry>`
cp index.php storeone/
cp .htacces storeone/
cd storeone/
sudo ln -s /var/www/html/app/ app && sudo ln -s /var/www/html/lib/ lib && sudo ln -s /var/www/html/pub/ pub && sudo ln -s /var/www/html/var/ var


cd `<magento-root-entry>`
cp index.php storetwo/
cp .htacces storetwo/
cd storetwo/
sudo ln -s /var/www/html/app/ app && sudo ln -s /var/www/html/lib/ lib && sudo ln -s /var/www/html/pub/ pub && sudo ln -s /var/www/html/var/ var

Edit storeone/index.php && storetwo/index.php

For example I display storeone/index.php, you need repeat the same in storetwo/index.php with slight adjustments.

 * 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');
 * $bootstrap->run($app);
 * --------------------------------------------
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.

ini_set('display_errors', 1);

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>

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'storeone'; //here you need to mention store or website code,in your case it is store code.
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store'; //here you need to mention, load page depends on store or website, in your case it is store.
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');

That's it, now check with www.myurl.com/storeone.

note: if you are using nginx, no need to copy .htaccess

  • thanks for your answer. this partial working. When i access the site is working but when i tried to access a product i receive 404. is there another seting to do for this? – Alin Lupoiu Sep 12 '17 at 13:42
  • what webserver are you using? – Bilal Usean Sep 12 '17 at 13:48
  • I use nginix webserver – Alin Lupoiu Sep 12 '17 at 13:51
  • I tested in apache, it works! no issues! just now I have tested in nginx, me too face the same issue. If I resolve, I'll update. – Bilal Usean Sep 12 '17 at 14:59

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.