📣🎄🎁❄️ WINTER SALE! | Exclusive offers for Cloud Shared Hosting - 70% OFF | Starting from $3.99/mo
Learn Magento 2

One of the most used Opensource E-Commerce Platform build on Enterprise level!

• Last Updated: 01/10/2020
• ( 15 minutes reading )

How to configure URLs, Pages and Cookies in Magento 2

Introduction

In this tutorial, our main focus will be on the “Web” section under the “General” settings tab of Magento. We will review how you can configure the actual URLs that your Online Store will be using. While some of the settings here might seem a little bit more advanced we will do our best to explain them as simple as possible. 

 

Getting Started

In order to begin, please log in to your Magento Admin Dashboard and navigate through the left menu bar to Stores > Configuration.

 

Accessing the Configuration page

 

Once you access the “Configuration” page, please switch to the “Web” section under the “General” tab.

 

Accessing the Web section

 

As you will notice the “Web” section is split into a few subsections which we will review one by one in the following lines. 

 

URL Options

Please, click on the first “Url Options” subsection in order to expand it.

 

URL Options

 

As you will notice both of the options here are set to use the system values, in case you need to enter custom values, please make sure to untick the corresponding “Use system value” checkbox.

  • Add Store Code to URLs - This setting determines whether Store Code is inserted to the URLs of your Online Store. You will notice that by default it set to “No”, if you would like the Store Code to be included you will be able to change it to “Yes” from the dropdown menu.
    An example of a URL with Store Code inserted:
    http://www. yourdomain.com/magento/[store-code]/index.php/url-identifier
    An example of a URL without a Store Code:
    http://www. yourdomain.com/magento/index.php/url-identifier
  • Auto-redirect to Base URL - This setting automatically redirects requests to your store’s base URL (i.e. http://yourdomain.com) instead of displaying a “404 Page Not Found” error message. Please note that for Magento multi-store setups it is recommended to keep it off (the “No” option from the dropdown menu). 

 

Search Engine Optimization

Please, expand the next “Search Engine Optimization” subsection.

 

SEO

 

Under this section, you will notice only one “Use Web Server Rewrites” setting. Simply put, enabling this option will omit the “index.php” filename from your store’s URL (i.e. “http://yourdomain.com” instead of “http://yourdomain.com/index.php”).

 

Base URLs

Next, please expand the “Base URLs” section. Here you will need to determine the settings of your store’s base URL running over the HTTP protocol.

 

Base URLs

 

  • Base URL - This is the actual web address of your Magento store’s root folder. If your store is located in a subdirectory it should be included (i.e. http://yourdomain.com/onlinestore/). Please note that the base URL should include a forward slash at the end of the URL.
  • Base Link URL - This is the markup tag (“{{unsecure_base_url}}”) that represents your HTTP base store URL.
  • Base URL for Static View Files - This is the markup tag (“{{unsecure_base_url}}static/”) that points to the folder where your HTTP store’s static files are located.
  • Base URL for User Media Files - This is the markup tag (“{{unsecure_base_url}}media/”) that points to the folder where your HTTP store’s media files are located.

 

Base URLs (Secure)

Please expand the following “Base URLs (Secure)” subsection. Here you will need to configure your store’s secure HTTPS URLs. Please note that in order for your website to work over the secure HTTPS protocol it requires a valid SSL certificate installed on it.

 

Base URLs (Secure)

 

As the first few settings are the same as under the “Base URLs” section and you already know what to do, we will focus only on the additional settings here.

  • Use Secure URLs on Storefront - This setting will allow you to force the secure HTTPS connection on your Storefront pages. In case you have an SSL certificate already installed on your domain name, we would recommend you to set it to “Yes”. Although, this is totally up to you, feel free to keep it set on “No” if you prefer your store to be accessible over the HTTP protocol.
  • Use Secure URLs in Admin - The same applies here, but for your Magento Admin Area pages.
  • Offloader header - Simply put, the SSL offloading means that the required process of running over an encrypted SSL connection is handled by another server. We would recommend you keep the default value here.

 

Default Pages

Please, expand the next “Default Pages” section. Here you will find the Magento default pages that are already preconfigured. However, if you prefer to customize them you are totally able to do so.

 

Default Pages

 

As usual, if you need to customize any of the settings you will have to first unmark the “Use default value” checkbox.

  • Default Web URL - This setting determines the landing page of your store’s base URL. In case you would like to use a custom page, please enter the path to the folder in the Magento Installation containing your landing page.
  • CMS Home Page - This setting determines the Home page of your store’s home page. The dropdown menu will list all currently created pages and you will be able to select the one you prefer to use.
  • Default No-route URL - This setting determines the URL for the default page displayed in case a “404 Page Not Found” error occurs.
  • CMS No Route Page - This setting determines which page will be displayed for “404 Page Not Found” errors. From the dropdown menu, you will be able to select between all current pages.
  • CMS No Cookies Page - This setting determines which page will be displayed in case the required cookies are disabled within your visitors’ browsers.
  • Show Breadcrumbs for CMS pages - This setting determines whether the breadcrumbs trial (showing where are you currently on the website) is displayed at the top of all your pages.

 

Default Layouts

Please, expand the next “Default Layouts” section. The settings available here will allow you to control the layouts on your pages.

 

Default Layouts

 

  • Default Product Layout - This setting determines the default layout used on your store’s product pages. From the dropdown menu, you can select between: “No layout updates”, “Empty”, “1 column”, “2 columns with left bar”, “2 columns with right bar”, “3 columns”.
  • Default Category Layout - This setting works exactly the same, but it determines the default layout used on your store’s category pages.
  • Default Page Layout - This setting determines the default layout used on your store’s CMS page. From the dropdown menu, you can select between “Empty”, “1 column”, “2 columns with left bar”, “2 columns with right bar”, “3 columns”.

 

Default Cookie Settings

Next, please expand the “Default Cookie Settings” subsection.

 

Default Cookie Settings

 

  • Cookie Lifetime - This setting will allow you to determine how long a cookie will be kept before it is deleted. The period is measured in seconds.
  • Cookie Path - This setting will allow you to determine where the cookies can be used. In case you would like to allow their usage everywhere under the Magento Installation directory, please enter just a forward slash (/) in the field.
  • Cookie Domain - This setting will allow you to control whether the cookie use is allowed for subdomains. In case you would like to allow it, please type your subdomain (e.g. subdomain.yourdomain.com).
  • Use HTTP Only - This setting will allow you to control the protocol of cookie usage. If you would like cookies to be used only over HTTP, please make sure it is set to “Yes”. Alternatively, if you wish cookies to be used over both HTTP and HTTPS protocols set it to “No”.
  • Cookie Restriction Mode - This setting will allow you to control the Cookie Restriction Mode. If enabled, your visitors will be prompt with a message stating that cookies are required for fully operational experience.

 

Session Validation Settings

Please, expand the following “Session Validation Settings” section. You will notice all the settings here are disabled and set to “No”, you can enable them by selecting “Yes” from the dropdown menu.

 

Session Validation Settings

 

  • Validate REMOTE_ADDR - If enabled this setting will verify if the IP address making a request matches “$_SESSION” data. In case it does not match the session will be terminated.
  • Validate HTTP_VIA - If enabled this setting will verify if the Proxy address making a request matches “$_SESSION” data. In case it does not match the session will be terminated.
  • Validate HTTP_x_FORWARDED_FOR - If enabled this setting will verify if the Forwarded-for address making a request for proxy data matches “$_SESSION” data. In case it does not match the session will be terminated.
  • Validate  HTTP_USER_AGENT - If enabled this setting will verify if the browser and device used for making a request match “$_SESSION” data. In case they do not match the session will be terminated.
  • Use SID on Frontend - If enabled this setting will add a unique Session ID (SID) code to your store’s URLs in order to ensure visitors are assigned to the right session data. 

 

Browser Capabilities Detection

Please, expand the last “Browser Capabilities Detection” section.

 

Browser Capabilities Detection

 

  • Redirect to CMS-page if Cookies are Disabled - If set to “Yes” this setting will automatically redirect the visitors who have their cookies disabled to the “CMS No Cookies Page”.
  • Show Notice if JavaScript is Disabled - If set to “Yes” this setting will display a notice to the visitors who have JavaScript Options disabled on their browser prompting them to enable them.
  • Show Notice if Local Storage is Disabled - If set to “Yes” this setting will display a notice if the local cache is disabled.

Finally, when you are ready, please do not forget to click on the “Save Config” button available at the top of the page in order to successfully record your settings preferences.

 

Save Config

 

Very well! At this point, you have all your URL settings successfully configured and you are ready to move forward to the rest of your Magento Store’s settings. We would like to congratulate you and thank you for trusting our guidance.

 

 

...
Sebahat
Technical Support Captain & Content Manager

Sebahat is a young and bright person who had become an invaluable part of our team. Started as a Customer Care Representative who quickly evolved into a Tech-savvy well familiar with every support layer of the company. Driven by the aim to constantly improve our customers’ experience she is committed to enhancing the extraordinary support we deliver.