Contact
Site: US UK AU |

How to change base URLs in Magento 2

How to change base URLs in Magento 2

Contents

Attention

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

Method 1: Magento 2 dashboard

  1. Log in to your dashboard. From the main menu, select Stores > Configuration.

  1. On the upper right, click System > Configuration.
  1. From the main menu, under the General list, click Web.
  1. Open the Unsecure and Secure drop-down lists, locate the base URL line, and replace this with the new URL.  
  2. 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.
  1. 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.
  2. Within the Value column, update the value of each specific secure and unsecure URL to the intended URL.
  3. 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 the Client Portal.

 

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 100.

  1. 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.
  2. Within the Value column, update the value of each specific secure and unsecure URL to the intended URL.
  3. 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 the Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How to reset Magento 2 admin passwords
Added on Fri, Jun 3, 2016
How to configure Magento 2 cron jobs
Added on Tue, Mar 27, 2018
How to add admins in Magento 2
Added on Mon, Dec 12, 2016
How to set the return-path email in Magento 2
Added on Thu, Apr 21, 2016
How to configure Magento 2 storefronts
Added on Wed, Dec 30, 2015
How to disable caching in Magento 2
Added on Wed, Oct 12, 2016
How to disable maintenance mode in Magento
Added on Fri, Dec 15, 2017
How to set up Magento 2 to use your SSL certificate
Added on Tue, Oct 11, 2016
How to write redirect (301) rules for Magento 2
Added on Wed, Jan 27, 2016
How to enable CAPTCHA for user creation in Magento 2
Added on Mon, Feb 19, 2018