The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

2 Steps to Configure Magento 2 Frontend

For an eCommerce website, Storefronts is the most important things when building the website. That is what customers see first when visiting your store. A store can have many Magento storefronts which include products, categories and search options. So, How To Configure Magento 2 Frontend in your store?

To configure Magento 2 Storefronts

Step 1: Build a Storefront

  • Access to Admin sidebar, then choose Products > Categories. Skip to Step 6 if you want your stores to share the same catalog and products

Step 1

  • Select Add Root Category

Add root category

  • In the Name field, type your new store name
  • In the Is Active field, click Yes
  • Expand Display Settings field, choose Yes in Anchor field. Then select Save Category
  • From Admin sidebar, select Stores. After that, under Settings options, choose All Stores

All Stores

  • Select Create WebSite in the right up corner
  • Enter your store name in Name field
  • Enter a unique string without spaces in the Code field then select Save Web site

Store

  • Select Create Store
  • In the Web site field, choose the website that you just created
  • In the Name field, type your store’s name
  • In the Root Category field, choose the root category that you just created or use the Default Root Category if you ignore ahead. Then select Save Store

Store information

  • Select Create Store View
  • In the Store field, choose the store that you just created.
  • In the Name field, enter a name such as “Cat”
  • In the Code field, enter a string to determine the store view.
  • Select Enabled in Status field then Click Save Store View

Store View Information

  • From the Admin sidebar, choose Stores > Configuration

Configuration

  • In the Store View field, choose the website that you just built.

Store View

  • In the panel on the left, choose the Web table option, expand the Base URLs and Base URLs(Secure) section.
  • In the Base URLs field, type your store’ URL by using one of the ways below:
  • Choose Use Default check box if you want to use your main store URL
  • To determine a store URL that other than your main, locate the Base URL field, type your store URL and add the “/” at the end of the URL.
  • In the Base URLs (Secure) section, do the same Base URLs
  • Choose Save Config to complete.

Related posts:

Step 2: Install the server to run the Storefront

There are a lot of methods to configure the server to run the exact store but the two most popular methods:

Method 1: Specific directories for every website use subdomains

  • Demonstrate the domain you want to point to the server.
  • Build a subdomain for your new store.
  • Using either FTP or SSH, copy the .htaccess and index.php files from your Magento settings to the document root of your new domain
  • Choose the index.php file that you just copied and edit the last lines of the file as below:

Notes: Convert new store to the code that you wrote down when you built the new website atop.

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 represent links in the document root or 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 
  • When the installation was successful, your new domain will run in your system and you can easily make the changes you want for your store

Method 2: Directories are shared for all stores using pointer domains

Notes: This method is only used for Magento version 1.4.0.1 and higher versions

  • Demonstrate the domain you want to point to the server.
  • Build a server alias pointer domain for your new store. The pointer domain will point to the main domain of your Magento installation.
  • Edit the .htaccess file in the document root of your Magento settings and type the below just above the line RewriteEngine On:
    • Replace .*newstore.* with the domain name of your new store, keeping the dots and asterisks.
    • Determine that MAGE_RUN_CODE matches the code you wrote down when you built the new website above. Newstore specifies the domain name of your new store, and websitecode identifies the store code generated in Magento
SetEnvIf Host .*newstore.* MAGE_RUN_CODE=newstore
SetEnvIf Host .*newstore.* MAGE_RUN_TYPE=website or store
  • When the installation was successful, your new domain will run in your system and you can easily make the changes you want for your store.

Related posts:

Image Description
Hello, I'm the Chief Technology Officer of Mageplaza, and I am thrilled to share my story with you. My deep love and passion for technology have fueled my journey as a professional coder and an ultra-marathon runner. Over the past decade, I have accumulated extensive experience and honed my expertise in PHP development.

Looking for
Customization & Development Services?

8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.

Get free consultant
development service
x

    Explore Our Products:

    People also searched for

    Subscribe

    Stay in the know

    Get special offers on the latest news from Mageplaza.

    Earn $10 in reward now!

    Earn $10 in reward now!

    comment
    iphone
    go up