View Categories

Update base URLs or change site name

5 min read

Base URLs are one of the most important parts of Magento and they cause constant trouble for our customers. The good thing is, by knowing about them you will save yourself infinite time and feel like a wizard.

Within the Magento admin, these values can be viewed by going to System -> Configuration -> Web (from the left-hand menu), then expand the secure and unsecure accordion fields. You will see something like this:

update base url

Note that only two fields have an actual URL, the rest have placeholder variables that file in the domain automatically. This is typical of every Magento install, though some customers have custom media/skin/js values for use with CDNs or other customization.

When a request is made to a Magento install, it will automatically redirect to whatever these values are, so you could update ServerGuy’s base URLs to google.com and suddenly visitors to ServerGuy.com would always end up at google.com.

Knowing that, you can see that set incorrectly they will redirect and cause strange behavior from the perspective of someone who is not aware of this, which is typical of customers. Subsequently, if a customer complains of a redirect problem, one of the first things to check after DNS is the base URL.

Updating the URL

Of course, we can always change an existing site by going through the admin, but we are better than that and half the time this is not possible because the problem is they will not be set correctly in the first place.  Therefore, we must go to the mysql command prompt.  To view the base URLs via command line, try the following:

  • Navigate to the Magento web root
  • Find local.xml in app/etc/ and determine which database is in use by the store you are working on
  • Type “mysql” to bring up the mysql command prompt – alternatively on MHM servers you can run n98-magerun.phar db:console to be taken directly to the proper database
  • Run the command use databasename; with the Magento database name
  • Run the query select * from core_config_data where path like "%secure%"; with a table prefix if necessary , you will get a big blob of values like this –

| config_id | scope   | scope_id | path                                    | value                                           |
+———–+———+———-+—————————————–+————————————————-+
|         4 | default |        0 | web/unsecure/base_url                   | https://serverguy.com/                            |
|         5 | default |        0 | web/secure/base_url                       | https://serverguy.com/                           |
|        13 | default |        0 | web/unsecure/base_link_url           | {{unsecure_base_url}}                          |
|        14 | default |        0 | web/unsecure/base_skin_url          | {{unsecure_base_url}}skin/                   |
|        15 | default |        0 | web/unsecure/base_media_url      | {{unsecure_base_url}}media/                |
|        16 | default |        0 | web/unsecure/base_js_url             | {{unsecure_base_url}}js/                        |
|        17 | default |        0 | web/secure/base_link_url              | {{secure_base_url}}                                |
|        18 | default |        0 | web/secure/base_skin_url             | {{secure_base_url}}skin/                         |
|        19 | default |        0 | web/secure/base_media_url          | {{secure_base_url}}media/                     |
|        20 | default |        0 | web/secure/base_js_url                 | {{secure_base_url}}js/                             |
|        21 | default |        0 | web/secure/use_in_frontend          | 1
|        22 | default |        0 | web/secure/use_in_adminhtml       | 1
|        23 | default |        0 | web/secure/offloader_header         | SSL_OFFLOADED                                 |
|       464 | default |        0 | carriers/usps/gateway_secure_url | https://secure.shippingapis.com/ShippingAPI.dll |
|       717 | default |        0 | kbase/url_rewrite/secure_urls        | 0
|       768 | default |        0 | google/checkout/use_secure_callback_url | 0
+———–+———+———-+—————————————–+————————————————-+

You can also do this via phpMyAdmin if you prefer

Now to apply the above change, re-index and clear the site cache.

Scroll to Top

We can help you. Right now.

Fast growing merchants depend ServerGuy for high-performance hosting. Experience counts. Let's get started.

Talk to a sales representative

USA / Worldwide

+1.714.2425683

India

+91.9852704704