Every Magento store has a base URL and another admin URL. Configuring Store URLs in Magento 2 enables you to easily move the whole store to another location without having to update all of the URLs. Hence, understanding exactly about the configuration of store URLs as well as all types of URLs is necessary 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 site owns a base URL and an Admin URL assigned to storefront and storeback respectively. If you plan to have multiple stores, you should include the store code in the URL.

Following the guide given below to create the Store URL for your own Magento 2 store.

To Configure Store URLs in Magento 2

Configure the Base URL

  • On the Admin Panel, Stores > Settings > Configuration.
  • On the left panel, under General, select Web.
  • Open the Base URL section,
    • Fill the Base URL for the store, however, the URL needs to end with a forward slash to extend the link with the additional URL later. For example,
http:// yourdomain.com

In the Base Link URL field, the placeholder link is available and used to create relative links to the base URL. Don’t edit it!

  • It is optional if you want to create an alternate location of the Base URL for Static View Files, for example:
{{unsecure_base_url}}
  • It is optional if you want to create an alternative location of the Base URL for User Media Files, for example:
{{unsecure_base_url}}
Base URLs
  • Save Config to complete.

Insert the store code in URLs

  • On the Admin Panel, System > Settings > Configuration.
  • On the left panel, under General, select Web.
  • Open the URL Options section:
  • Choose Yes in the Add Store Code as you need.
    • 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
URL Without Storecode
  • Click Save Config to complete.
  • When prompted, click on Cache Management link to flush the cache.

Configure the secure Base URL

  • Open the Base URL (Secure) section,
    • Fill the full Secure Base URL and the end character is a forward slash. For example:
http:// yourdomain.com
  • In the Secure Base Link URL field, the placeholder link is available and used to create relative links to the base URL. Don’t edit it!
  • It is optional if you want to create an alternative location of the Secure Base URL for Static View Files, for example:
  • It is optional if you want to create an alternative location of the Secure Base URL for User Media Files, for example:
  • In the Use Secure URLs in Frontend, choose Yes if you want to run the entire storefront over a secure (https) channel.
  • In the Use Secure URLs in Admin, choose Yes if you want to run the entire admin over a secure (https) channel.
Secure Base URLs
  • Click Save Config to complete.

Store URLs configuration needs to be done to solve the store moving problem. Once you have completed these settings, you can be rest assured that the store links are always updated. Thanks for reading, and good luck setting things up! Drop your comments below so that we can discuss further, just in case!