Follow this and comment for any issue:
- Verify your desired domain name points to the server.
- Create a secondary domain for your new store.
- Using either FTP or SSH, copy the .htaccess and index.php files from your Magento installation to the document root of your new domain.
- Open the index.php file that you just copied and edit the last lines of the file as follows:
Attention: Change newstore to the code that you wrote down when you created the new website above.
Replace:
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);
With:
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'newstore';
$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);
- Using SSH, create the following symbolic links in the document root of your new domain, and replace the path below with the full path to the document root of your Magento Installation:
ln -s /home/example/example.com/html/app/ app
ln -s /home/example/example.com/html/lib/ lib
ln -s /home/example/example.com/html/pub/ pub
ln -s /home/example/example.com/html/var/ var
Update in Your case:
Replace ln -s /home/example/example.com/html/app/ app
with ln -s /var/www/html/m2/example.com/app/ app
Make sure your configuration looks like this:
Stores > Configuration > General > Web:
Base URLs:
Base URLs (Secure):
- Secure Base URL: https://www.yourdomain.com/
- Secure Base Link URL: {{secure_base_url}}
- Use Secure URLs on Storefront: Yes
- Use Secure URLs in Admin: Yes
- Enable HTTP Strict Transport Security (HSTS): Yes
- Upgrade Insecure Requests: Yes
After changing the URLs, clear the cache! You might as well need to a new deployment and/or run
bin/magento setup:static-content:deploy
and clear the cache again.
Best Answer
Run following query in database
or if you have already value for that path, then change it from 1 to 0.
Then flush cache and deploy static content as follows.