There are several ways to configure the base_url settings of your Magento 2 shop.

note: When you have an SSL certificate and use the secure base URL you should change the unsecure base URLs to HTTPS as well. This could result in conflicts when you leave this to HTTP.

Configuring your base URL’s over the web

Configure your base URL’s in the Magento 2 admin

To configure your base URL’s from within Magento 2, first login to your Magento admin area.

From the top navigation bar, select Stores > Configuration:


From the configuration menu, select the General dropdown and select Web:

Open the secure and unsecure dropdown sections from the page:

Now, insert the correct URL configuration in the base url input box and click on Save Config

After saving your adjusted base URL’s config, navigate to System > Cache Management:

To clear your caches, click the big orange button at the top of the page:

Configure your base URL’s using PHPmyAdmin

As changing the base URLs using PHPmyAdmin works the same for both Magento 1 and Magento 2, take a look at the Magento 1 article about changing base URLs.

Configuring your base URL’s using SSH

Change base URL’s settings with MySQL from the command line

To change your base URLs using plain MySQL queries, you can use exactly the same commands as described in the Magento 1 article.

Change your base_url using n98-magerun2

Changing your base URLs using n98-magerun2 on Magento 2 is yet not as easy as with Magento 2 as there are no plugins yet to provide this functionality.
Therefor we use the config:store:set functionality in n98-magerun2.

To do this, login on your Hypernode using SSH and navigate to your Magento 2 directory:

Then, get an overview of the current base URL settings:

This will print out a list of your storefronts and their URL configuration:

Next run magerun2 and set the base URLs:

Keep in mind:

  • Make sure the base-urls are always ending with a trailing slash (/)
  • Replace the url for SHOPHOST with the url of you shop.

Change the base URLs to SSL using a script

If you want to change your base URL for use with SSL, we created a handy python script that you can use to quickly adjust your base URLs to use SSL. To make use of this script, setting the unsecure base URL first is required.

To use it, download the script, make it executable and run it:

Now check your base URLs using Magerun:

75