【问题标题】:magento multistore subfolder without symlinks没有符号链接的 magento 多存储子文件夹
【发布时间】:2012-11-09 20:34:53
【问题描述】:

是否可以在不需要创建符号链接的情况下设置带有子文件夹/子目录的 magento 多存储?

For example:
www.mainstore
www.mainstore/store1
www.mainstore/store2
www.mainstore/store3

出于安全原因,一些托管服务提供商禁用了符号链接,通常的方法是在 magento 根目录中为每个商店创建一个文件夹,将 index.php 和 .htaccess 复制到其中,并为所有其他 magento 文件夹创建符号链接,像这样:

ln -s /home/example/example.com/html/app/ app
ln -s /home/example/example.com/html/includes/ includes
ln -s /home/example/example.com/html/js/ js
ln -s /home/example/example.com/html/lib/ lib
ln -s /home/example/example.com/html/media/ media
ln -s /home/example/example.com/html/skin/ skin
ln -s /home/example/example.com/html/var/ var

我认为 .htaccess 重写也许是可能的,但我不知道如何设置。

感谢您的帮助! :)

【问题讨论】:

    标签: magento


    【解决方案1】:

    看看@Magento Multi store setup sub folders

    使用 .htaccess 使用同一文件夹设置多存储。

    在 magento 中设置您的商店后,更新您的 .htaccess 文件

    SetEnvIf Host www\.store1\.com MAGE_RUN_CODE=base
    SetEnvIf Host www\.store1\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^store1\.com MAGE_RUN_CODE=base
    SetEnvIf Host ^store1\.com MAGE_RUN_TYPE=website
    
    SetEnvIf Host www\.store2\.com MAGE_RUN_CODE=store2
    SetEnvIf Host www\.store2\.com MAGE_RUN_TYPE=store
    SetEnvIf Host ^store2\.com MAGE_RUN_CODE=store2
    SetEnvIf Host ^store2\.com MAGE_RUN_TYPE=store
    

    阅读更多@

    【讨论】:

    • 谢谢@R.S.我指的是具有不同子文件夹的唯一域中的一个 magento 安装,而不是不同域。例如:domain.com/store1domain.com/store2 你能帮我解决这个问题吗?谢谢!
    • 我在 magento 根目录中尝试了您的示例,但始终出现 404 错误。如果我使用 magento store2 名称创建一个文件夹,例如 /magento_root/store2 并在 index.html 中复制,默认 .htaccess 不会显示 404 错误并加载,但没有显示 sotore 所需的所有文件,因为不是符号链接。我试图在 htaccess 的 /store2 文件夹中插入,但仍然没有工作。您知道如何在 .htaccess 中插入与符号链接具有相同功能的重写吗?谢谢! :)
    • 我可以确认这个解决方案完美!谢谢你:)
    猜你喜欢
    • 2017-05-02
    • 2011-06-16
    • 2012-12-14
    • 2017-12-10
    • 2018-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-26
    相关资源
    最近更新 更多