0

I have tried to use the approach described here Magento: storing base url in a config file to set my base url from an xml file.

I have put the following in the file baseurl.xml in app/etc. It seems to be loaded (if I put a deliberate error in it, I get an error). However, it's having no effect (I would expect to get a garbage set of links). I wonder if it's because I might have set things through System>Configuration>Web in the past? Is there a way of clearing that out (eg delete entries from the database)? And is there a good reference for where this is documented?

<?xml version="1.0"?>
<config>
<default>
<web>
    <unsecure>
        <base_url>http://yourdomain/magento/</base_url>
    </unsecure>
    <secure>
        <base_url>http://yourdomain/magento/</base_url>
    </secure>
</web>
</default>
<websites>
<ws_code>
    <web>
        <unsecure>
            <base_url>http://yourdomain/magento/</base_url>
        </unsecure>
        <secure>
            <base_url>http://yourdomain/magento/</base_url>
        </secure>
    </web>            
</ws_code>
</websites>
<stores>
<store_code>
    <web>
        <unsecure>
            <base_url>http://yourdomain/magento/</base_url>
        </unsecure>
        <secure>
            <base_url>http://yourdomain/magento/</base_url>
        </secure>
    </web>            
</store_code>
</stores>
</config>
Community
  • 1
  • 1
PedroKTFC
  • 745
  • 10
  • 28

1 Answers1

2

"...is there a good reference for where this is documented?"

Every Magento developer will enjoy that question! :-)

There is no documentation to speak of. Magento makes varied (and confusing) use of its configuration DOM. One of the confusing aspects is that part of the config DOM structure is stored in the database in the core_config_data table.

What has happened in your case is that the DOM XPaths which you are setting are being overwritten when the database-based content is merged in. While you could unset these values in the database via direct query or setup script (the latter of which could be used to delete or overwrite the values in the database), unless you restrict access to these then they can be overwritten again.

It's up to you to determine what's best for your users. You may want to remove access to System > Configuration > Web for admin users via the ACL roles functionality.

benmarks
  • 23,384
  • 1
  • 62
  • 84
  • (I know what you mean about documentation, I was just dreaming really!) By unset do you mean deleting the actual rows in the database? I set them to {{base_url}} but I still get the same effect. As for disabling others getting them, I'm the only admin so I just have to stop myself! :o) – PedroKTFC May 08 '14 at 12:44
  • You will need to remove those values from the database. – benmarks May 08 '14 at 16:13
  • I finally tracked it down! My settings are being overwritten by those in in `app/code/core/Mage/core/etc/config.xml`. This is a pain as all I want is a simple way of specifying base urls for dev/test/prod type environments. Using a module seems a little OTT for something like this. – PedroKTFC May 08 '14 at 21:35