无法从配置文件设置基本网址 [英] Unable to set base url from config file

查看:61
本文介绍了无法从配置文件设置基本网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用此处所述的方法 Magento:存储基础配置文件中的网址以从xml文件设置我的基本网址.

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.

我将以下内容放入app/etc中的baseurl.xml文件中.它似乎已加载(如果我在其中添加了故意的错误,则会收到错误).但是,它没有任何效果(我希望得到一组垃圾链接).我想知道是否是因为过去可能通过System> Configuration> Web进行了设置?有没有一种清除方法(例如,从数据库中删除条目)?并有很好的参考记录在何处?

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>

推荐答案

"...在哪里记录有很好的参考?"

每个Magento开发人员都会喜欢这个问题! :-)

Every Magento developer will enjoy that question! :-)

没有文档可谈. Magento对其配置DOM进行了多种使用(且令人困惑).令人困惑的方面之一是config DOM结构的一部分存储在core_config_data表中的数据库中.

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.

您的情况是,合并基于数据库的内容时,正在设置的DOM XPath被覆盖.尽管您可以通过直接查询或设置脚本在数据库中取消设置这些值(后者可以用来删除或覆盖数据库中的值),除非您限制对这些值的访问,否则它们可以再次被覆盖.

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.

由您决定最适合您的用户.您可能希望通过ACL角色功能删除对Admin用户的系统">配置">"Web"访问权限.

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.

这篇关于无法从配置文件设置基本网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆