How to change your Magento base url

in Magento

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

Configuring your base URL’s over the web

Configure your base URL’s in Magento

  • To configure your base URL’s from within Magento, 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

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

  • Open phpMyAdmin 
  • 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}}js/

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

  • Then 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 commandline 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.

NOTE: 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 commandline 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 urls 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)

0