Let us look at the 3 simple ways on how to change Magento base URLs for your website. We will go step-by-step with each method to make it easier to implement.
The three methods to change Magento base URLs include:
- Via Magento Admin Panel
- Command Line
The first method that we will discuss to change Magento base URLs is via Magento Admin Panel. Here are the steps:
- Log in to your Magento Admin Panel
- On the upper right of the screen, click System > Configuration
- On the left menu, under the General list, click Web
- Go to the ‘Unsecure and Secure dropdown’, and then replace the old base URL line with the new URL.
- After that, clean the Magento and your browser’s cache. And that’s it, you’re done and the site will open now.
The second method that we will discuss to change Magento base URLs is via Command Line method. Here are the steps:
- Login to the server hosting Magento database via SSH
Enter the following command, where
$database_user is the database user and $database_name is the database: mysql -u $database_user -p $database_name
- Enter your password when required
- Access their database using the following command, where database is the database name
- Then, run this command
select * from core_config_data where path like '%base%url%';
6. The command will display current base_urls set in Magento.
7. Now to change base URLs, run the following commands
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';
The third method that we will discuss to change Magento base URLs is via PhpMyAdmin. Here are the steps:
- Login to your SiteWorx account
- On the left menu, click Hosting Features > MySQL > PhpMyAdmin
- You have arrived at the PhpMyAdmin main menu. Now, on the left click on the Magento database name that corresponds to the URL you wish to change.
- Then, you will see a list of all the tables in the database sorted alphabetically.
Search for the core_config_data table and click Browse
- Expand the viewing area of PhpMyAdmin. At the top and bottom in the main panel, find a gray box and increase the number of rows to a higher number, such as 200.
- Find the row
web/unsecure/base_url and web/secure/base_url
and then click Edit next to the respective lines. Change the base URL to the intended string, and press OK.
- In the Value column, change the value of each specific ‘secure and unsecure’ URL to the desired URL.
- Next, flush the Magento cache, and now your Magento website will ideally load with the set base URLs.
Hence, now you understand the 3 methods step-by-step on how to change the base URLs for your Magento website. In case of any queries, reach us at email@example.com