How to change your Magento 1 base URL

in Magento

Information on how to change your Magento 2 base URL can be found here.

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

Configuring your base URL’s over the web

Configure your base URL’s in the Magento 1 admin

To configure your base URL’s from within Magento 1, first login to your Magento admin area.
From the top navigation bar, select System > Configuration:

System->Configuration

From the menu on the left, select General > Web:

General->Web

Open the secure and unsecure sections from the dropdown:

base_urls

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:

System->Cache_Mgmt

To clear your caches:

CacheMgmt

Configure your base URL’s using phpMyAdmin

First, open phpMyAdmin
Next, select the database of your Magento shop and open your core_config_data table.

Sort table by column path and find the following rows in the unsecure section:

Path Value
web/unsecure/base_url http://www.hypernode.com/
web/unsecure/base_link_url {{unsecure_base_url}}
web/unsecure/base_skin_url {{unsecure_base_url}}skin/
web/unsecure/base_media_url {{unsecure_base_url}}media/
web/unsecure/base_js_url {{unsecure_base_url}}

Replace http://www.hypernode.com/ with the appropriate domain URL and make sure the base_url always ends with a trailing slash.

After that, adjust the secure_base_url configuration in the dropdown and find the following rows in the core_config_data table in the secure section:

Path Value
web/secure/base_url `https://www.example.com/
web/secure/base_link_url {{secure_base_url}}
web/secure/base_skin_url {{secure_base_url}}skin/
web/secure/base_media_url {{secure_base_url}}media/
web/secure/base_js_url {{secure_base_url}}js/

If you do not have SSL/TLS on your Hypernode yet, use HTTP instead of HTTPS.

Now clear your cache from the Magento admin or run n98-magerun clear:cache on the command line of the Hypernode.

Clearing cache and sessions is necessary because your config is cached and clearing it forces a reload of the configuration data from the core_config_data table.

If you have set your base_url correctly for web/unsecure/base_url and web/secure/base_url you do not have to change the {{secure_base_url}} and {{unsecure_base_url}} macros in the rest of the entries.

Configuring your base URL’s using SSH

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

Log into your MySQL database, by connecting and typing your password:

mysql -u app -p

Below are the SQL commands to change your base_url values. Replace unsecure url http://www.hypernode.com/ and secure url https://www.hypernode.com/ with the domain name of your webshop. (don’t forget the trailing slash)

UPDATE core_config_data SET value = 'http://www.hypernode.com/' WHERE path LIKE 'web/unsecure/base_url';
UPDATE core_config_data SET value = 'https://www.hypernode.com/' WHERE path LIKE 'web/secure/base_url';

Verify the correctness of your base_url settings with the following statement:

SELECT path,value FROM core_config_data WHERE path LIKE 'web/unsecure/base%';
SELECT path,value FROM core_config_data WHERE path LIKE 'web/secure/base%';

Now clear your cache from the Magento admin or run n98-magerun clear:cache on the command line of the Hypernode.

Change your base_url using n98-magerun

Changing your base url using Magerun is quite easy thanks to the awesome addons created by Peter Jaap Blaakmeer

Login on your Hypernode using SSH and navigate to your Magento directory:

cd ~/public/

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

n98-magerun sys:store:config:base-url:list

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

Magento Stores - Base URLs

+----+---------+------------------------------+------------------------------+
| id | code | unsecure_baseurl | secure_baseurl |
+----+---------+------------------------------+------------------------------+
| 1 | default | http://support.hypernode.io/ | http://support.hypernode.io/ |
+----+---------+------------------------------+------------------------------+

Next run Magerun and answer the questions asked by the script:

n98-magerun sys:store:config:base-url:set

Now you can change the default base URL by selecting Main shop or change the base URL’s of your storefronts by selecting Storeview and fill in all the answers to the questions the script is asking you. (Don’t forget the trailing slash at the end of the URL)

Change the base URL’s 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 URL’s. 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:

cd /data/web/public
wget https://gist.githubusercontent.com/hn-support/0c76ebb5615a5be789997db2ae40bcdd/raw -O change-baseurls.py
chmod +x change-baseurls.py
./change-baseurls.py

Now check your base URL’s using Magerun:

n98-magerun sys:store:config:base-url:list

0