Configure the base URL

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. Under General in the left panel, choose Web.

  3. Expand Expansion selector the Base URL section.

    • Base URL — Enter the fully qualified base URL for your store. Make sure to end the URL with a forward slash, so it can be extended with additional URL Keys from your store. For example: http://yourdomain.com/

      NOTE
      Do not change the placeholder in the Base Link URL field. It is a placeholder that is used to create relative links to the base URL.
    • Base URL for Static View Files — (Optional) Specify an alternate location for the base URL for static view files by entering the path starting with the following placeholder:

      {{unsecure_base_url}}

    • Base URL for User Media Files — (Optional) Specify an alternate location for the base URL for user media files by entering the path starting with the following placeholder:

      {{unsecure_base_url}}

      For a typical installation, there is no need to update the paths for the static view files or media files because they are relative to the base URL.

    General configuration - web base URLs

    NOTE
    Placeholders enclosed in double braces are markup tags for variables.
  4. When complete, click Save Config.

Configure the secure base URL

If your domain has a valid security certificate, you can configure the URLs of both the storefront and Admin to transmit data over a secure (https) channel. Without a valid security certificate, your store cannot operate with secure (SSL/TLS) protocol.

  1. Expand Expansion selector the Base URLs (Secure) section and do the following:

    General configuration - secure base URLs

    • Secure Base URL — Enter the full secure base URL, followed by a forward slash. For example: https://yourdomain.com/

    • Secure Base Link URL — Do not change the placeholder in the secure base link URL field. It is used to create relative links to the secure base URL.

    • Secure Base URL for Static View Files — (Optional) Specify an alternate location for the secure base URL for static view files by entering the path starting with the following placeholder:

      {{secure_base_url}}

    • Secure Base URL for User Media Files — (Optional) Specify an alternate location for the secure base URL for user media files by entering the path starting with the following placeholder:

      {{secure_base_url}}

  2. To enhance security, set both of the following options to Yes.

    • Use Secure URLs on Storefront
    • Use Secure URLs in Admin
  3. For Enhanced Security Settings, do the following:

    • Enable HTTP Strict Transport Security (HSTS) — If you want your store to display only secure HTTPS page requests, set to Yes.

    • Upgrade Insecure Requests — To upgrade any requests for standard unsecured HTTP pages to secure HTTPS, set to Yes.

  4. Set the Offloader Header for your server.

    Most Commerce installations use the default X-Forward-Proto to identify the protocol as either HTTP or HTTPS. If your server configuration uses a different offloader_header, enter it here.

  5. When complete, click Save Config.