How to customize the Store URLs in Magento 2

Understanding precisely the configuration of store URLs as well as all types of URLs is compulsory for you in developing a Magento 2 store. There are 3 types of URL, for example:

Base URL

http:// www.yourdomain. com/magento/

  • Secure Base URL
    https:// www.yourdomain .com/magento/

  • URL with IP address
    http:// ###.###.###.###/magento/

Your Default Magento 2 website assigned to the storefront as well as store back which owns a base URL and Admin URL. If you decide to make multiple stores, you must include the store code in the URL.

Follow the following guideline to create your own Store URL of Magento 2

Customize the Base URL

  • On the Dashboard of Magento 2, Stores > Settings > Configuration.
  • On the sidebar, click on the General, select web.
  • Open the Base URL section,
    • Fill in the Base URL for your store, but, the URL needs to end with a forward slash to continue the link with the new URL later. For example,

http:// yourdomain.com

In the Base Link URL section, there is a link available to link placeholder and it is also used to create the relative links to the base URL.

Note:

Do not edit it!

  • This is is an alternative option for you to create the Base URL for Static View Files,
    For Example:
    {{unsecure_base_url}}

  • This is an alternative option for you to create the Base URL for User Media Files,
    For Example:
    {{unsecure_base_url}}

1_5.png



 

  • Save Config to complete.

Insert the Store Code-in URLs

  • On the Dashboard in Magento 2, System > Settings > Configuration.
  • On the Sidebar, click on the General, select web.
  • Open the URL Options section:
  • Select Yes in the Add Store Code as you want.
    • URL with Store Code
http://www. yourdomain.com/magento/store-view/index.php/urlidentifier

 

  • URL without Store Code

 

http://www. yourdomain.com/magento/index.php/url-identifier

 

4_3.png

  • Click Save Config to complete.
  • When prompted, click on the Cache Management link to clean the Cache.

Configure the secure Base URL

  • Open the Base URL (Secure) Section,
    • Fill in the full Secure Base URL and the end character is a forward slash.
      For Example:

http:// yourdomain.com

  • In the Secure Base Link URL section, there is a link available to link placeholder and it is also used to create the relative links to the base URL.

    Note:

    Do not edit it!

  • This is is an alternative option for you to create the Secure Base URL for Static View Files, For Example:
  • This is is an alternative option for you to create the Secure Base URL for User Media Files, For Example:
  • In the Use Secure URLs in the frontend, Select Yes if you need to start the entire storefront over a secure (https) channel.
  • In the Use Secure URLs in the Admin, Select Yes if you need to start the entire admin over a secure (https) channel.

Base URLs (Secure)

3_1.png


  • Click Save Config to complete.

 

If you are looking for an Ecommerce company, Visit Magento Ecommerce Company.