Change Magento Base URL without accessing Admin Dashboard
Posted on July 2nd, 2019
Magento is a widely used framework to set up e-commerce stores on the internet. You can create and manage any kind of eCommerce store using Magento. In this tutorial, we will see how to update the Base URL of our Magento website without accessing the admin dashboard.
There may be times when you want to change the base URL of your website. For example, if you want to change the website URL from http://domain.com to http://www.domain.com or want to replace the HTTP URL to HTTPS. You can refer the following methods for changing the base URL.
In this tutorial, we are going to discuss how to change the Magento website URL without accessing Magento admin dashboard. Sometimes in case of downtimes, you cannot access the Magento admin dashboard. If that is the case, you can follow any of the two methods mentioned in this tutorial to update the base URL of your Magento website.
Method 1: Changing URL via phpMyAdmin
1) Login to cPanel.
2) Go to Databases >> phpMyAdmin.
3) Select the database associated with the Magento website.
4) Locate the table “core_config_data” and click on it.
5) Locate the following lines by clicking edit option:
web/unsecure/base_url: Enter the unsecured base URL (eg: http://domain.com) for your website. Also please make sure that the URL ends with a forward slash (/).
web/secure/base_url: Enter your unsecured base URL(http) to secure base URL(https).
6) Click the “Go” button for updating the changes.
If you can’t access the phpMyAdmin, you can use the command line method for updating base URLs
Method 2: Using the Command-line
1) Login to your server via SSH.
2). Enter the following command:
mysql -u $database_user -p $database_name
Replace the database_user and database_name with your corresponding website database username and password.
3) Access the corresponding database using the command:
Replace database_name with your database.
4) Execute the following command to display the current base URLs for your website:
select * from core_config_data where path like ‘%base%url%’;
5) Use the following command for updating the base URLs:
update core_config_data set value = ‘http://example.com/‘ where path = ‘web/unsecure/base_url’;
update core_config_data set value = ‘https://example.com/‘ where path = ‘web/secure/base_url’;
So, this is how you can update the base URL of your Magento website without accessing the Magento admin dashboard. If you need more help with the process, please comment down below.