### [麦进斗 Magento 设置多站点、多域名、多语言、多货币](https://pmself.com/article/456) **Published:** 2021-06-09T09:22:22 **Author:** crawlpw **Excerpt:** 1、登录后台system->manage stores多站点选择create website: 进入: 填写完… ![](http://pmself.com/wp-content/uploads/2021/06/2021061702101737.jpg) 1、登录后台system->manage stores 多站点 选择create website: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400379-be23605a0ce6b43-300x79.png) 进入: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400375-3050ea69e88d968-300x112.png) 填写完整后,保存,再去该website下新建store和store view store新建: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400377-8126ebab4ca64f7-300x88.png) 2、store下面可以新建多个store view(即多语言设置),Code的值是展示view的关键所在 每个view代表着一种语言,所以建立多个view时,需要去下载安装语言包,magento-community ![](http://heyapp.store/wp-content/uploads/2020/01/1578400376-bf7e605f315a211-300x103.png) 3、多个网站,重复上面步骤即可。 4、多域名设置 system->confirguration ![](http://heyapp.store/wp-content/uploads/2020/01/1578400379-657d69592247414-216x300.png) 5、然后在选择,GENERAL标签下的Web: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400375-9155a10e2ab1e0f-300x154.png) 6、取消use default(或者 use website)前面的勾, 在Unsecure和Secure的base url中输入你已经拥有的域名 点击保存。 7、多域名设置的最后一步,修改项目根木的 .htaccess文件: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400379-a0b1fce88225656-300x112.png) 打开文件在最后加入: ``` SetEnvIf Host ^xncp.mez100.de.cn MAGE_RUN_CODE=de /* Store or website code 这里的code新建store view时的code输入框的值*/ SetEnvIf Host ^xncp.mez100.de.cn MAGE_RUN_TYPE=website /* Run store or run website */ ``` 8、多货币的设置 view或website设置多货币 再选择下方的currency Setup: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400377-6715ef2c59d249b-300x170.png) 依次设置基础货币、默认货币、所允许的货币 在Allowed Currencies选择多个值后,保存,实现多货币的设置 在去设置货币汇率。这个如果不设置的话,在前台不会出现货币转换的选项: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400377-f8ff1c89109c194-300x207.png) 这里可以设置货币的汇率以及货币的符号 货币汇率: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400376-f032cf458af3250-300x32.png) 货币符号: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400378-0ff33cbbd1b1296-300x23.png) 设置好后,保存,在前台就可以看见货币转为的选项了。 **下面还有一种多域名的做法(又称二级目录)** 假设我们的网站现在有个vip的站点(只有允许vip用户访问) 1、登录后台system->configuration,选择对应的website或store view ,选择左侧的 web 标签: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400380-7466090cafb52f0-300x185.png) 注意:`{{secure_base_url}}/de`有个斜线,设置的时候不要漏掉。 按上图配置好后,点击保存。 2、回到项目的根目录中,新建一个de的文件夹(这里的de为你在后台配置web下Base Link URL后面追加的那个de),创建如下: ![](http://heyapp.store/wp-content/uploads/2020/01/1578400378-84ca6f66495c41d.png) 将更目录的index.php的内容copy到de文件下的inde.php,文件.htaccess也一样从根目录的.htaccess 拷贝到de文件夹下的.htaccess 3、修改de文件下的index.php; ```

Whoops, it looks like you have an invalid PHP version.

Magento supports PHP 5.2.0 or newer. Find out how to install Magento using PHP-CGI as a work-around.

'; exit; } /** * Error reporting */ error_reporting(E_ALL | E_STRICT); /** * Compilation includes configuration file */ $compilerConfig = '../includes/config.php'; if (file_exists($compilerConfig)) { include $compilerConfig; } $mageFilename = '../app/Mage.php'; $maintenanceFile = '../maintenance.flag'; if (!file_exists($mageFilename)) { if (is_dir('downloader')) { header("Location: downloader"); } else { echo $mageFilename." was not found"; } exit; } if (file_exists($maintenanceFile)) { include_once dirname(__FILE__) . '/errors/503.php'; exit; } require_once $mageFilename; #Varien_Profiler::enable(); if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) { Mage::setIsDeveloperMode(true); } #ini_set('display_errors', 1); umask(0); /* Store or website code */ $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; /* Run store or run website */ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; /*de为 website or store view code*/ /*如果该站点为website的话,将store改为wensite即可*/ Mage::run('de', 'store'); ``` 4、然后在浏览器中输入www.xample.com/de就可以访问相应的store view或website了 **Categories:** 技术, 资源 ---