Nexcess Logo

How to change base URLs in Magento 2

Knowledge Base Home

Notice anything different?

We've enhanced the appearance of our portal and we're working on updating screenshots. Things might look different, but the functionality remains the same.
September 11, 2019

Three methods of changing base URLs for your single-store Magento 2 installation.


These methods work only for sites using a single-store Magento setup, not a multi-store setup.

Method 1: Dashboard

  1. Log in to your dashboard. From the main menu, select Stores > Configuration.
  1. On the upper right, click System >Configuration.
  2. From the main menu, under the General list, click Web.
  3. Open the Unsecure and Secure drop-down lists, locate the base URL line, and replace this with the new URL.

  4. Clear the Magento cache and your browser's cache. The site should now load properly.   

Method 2: PhpMyAdmin

  1. Log in to your SiteWorx account.
  2. From the main menu, click Hosting Features > MySQL > PhpMyAdmin.
  3. You will see the main menu for phpMyAdmin. On the left, locate and click the name of the Magento database corresponding to URL you want to change.
  4. You will see a list of all the tables in the database in alphabetical order.  Search for the core_config_data table and click Browse.
  5. Expand the viewing area of phpMyAdmin. At the bottom of the main panel, locate the grey box and change the Number of rows to a larger number, such as 30.
  6. Locate the rows web/unsecure/base_url and web/secure/base_url and click Edit next to the corresponding lines. Change the base URL to the intended string, and click OK.

  7. Within the Value column, update the value of each specific secure and unsecure URL to the intended URL.

  8. Flush the Magento cache, and the site should load with the set base URLs properly now.   

Method 3: Command line

ATTENTION: Only use this method if you are familiar with the command line and MySQL queries.

ATTENTION: Angled brackets (<>) indicate placeholder information. Replace the brackets and everything between them with the indicated information.

  1. Use SSH to log in to the server hosting the Magento installation's database.

  2. Enter the following command:
    mysql -u <$database_user> -p <$database_name>
  3. Enter your password when prompted.

  4. Access their database using the following command:
    use <database_name>
  5. Execute:
    select * from core_config_data where path like '%base%url%';
  6. This will display the current base_urls set in Magento.

  7. To change the base URLs, execute:
    update core_config_data set value = 'http://domainname/' where path = 'web/unsecure/base_url';
    update core_config_data set value = 'http://domainname/' where path = 'web/secure/base_url';

For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.

Jason Dobry
We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.