cancel
Showing results for 
Search instead for 
Did you mean: 

Magento single store on a subfolder

Magento single store on a subfolder

Hello.

I'm new to Magento, and I'm trying to install it so that the store (single store, the default one) can be accessed by the URL: http://sitename/na

 

1) I installed it on the dir : /var/www/magento-test/html

2) I followed the receipt in https://devdocs.magento.com/guides/v2.4/release-notes/open-source-2-4-2.html#known-issues, but it doesn't work. What I get is the following:

magento-error.png

My apache virtual host looks like:

 

VirtualHost *:80>

    ServerName www.<sitename>
    ServerAlias <sitename>
    DocumentRoot /var/www/magento.test/html/pub/na
.....
.....

Magento version: 2.4.4

 

Can anybody help me to understand what I am doing wrong?

 

Thanks a lot

 

1 REPLY 1

Re: Magento single store on a subfolder

Sorry, I forgot to include the index.php that I wrote from the known-issues above:

 

   <?php
   require realpath(__DIR__) . '/../../app/bootstrap.php';

   switch ($_SERVER['HTTP_HOST']) {
       case '<sitename>':
       case 'www.<sitename>':
           $params = $_SERVER;
           $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'na';
           $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
           $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
           $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
           $bootstrap->run($app);
           break;

       default:
           $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
           /** @var \Magento\Framework\App\Http $app */
           $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
           $bootstrap->run($app);
       break;
   }