【问题标题】:Unable to access sub directories / folders with Magento installed at root?无法访问安装在根目录下的 Magento 的子目录/文件夹?
【发布时间】:2012-09-22 22:55:11
【问题描述】:

我在我的域的根目录安装了 Magento,我正在尝试在 mydomain.com/forum/ 的子文件夹中安装一个论坛,但它似乎是 Magento 的 .htaccess(位于 mydomain.com/.htaccess当然)正在阻止对子目录 /forum/ 的任何请求。

每当我访问 /forum/ 或 /anything 时,它只会给出 404 错误,而不是提供位于那里的实际文件。

知道我可以在不破坏 Magento 的 URL 重写的情况下解决这个问题吗?好烦啊……

谢谢!

【问题讨论】:

  • htaccess 是什么样的?

标签: .htaccess magento mod-rewrite


【解决方案1】:

问题解决了。

似乎这是一个权限问题,因为我安装了 suPHP。虽然我对 /forums/ 下的所有内容进行了 chmod,文件设置为 644,文件夹设置为 755,但 /forums/ 本身并没有这样做。

chown -R youruser /home/youruser/public_html/forums
chgrp -R youruser /home/youruser/public_html/forums
find /home/youruser/public_html/forums -type f -exec chmod 644 {} \;
find /home/youruser/public_html/forums -type d -exec chmod 755 {} \;

suPHP:http://www.kavoir.com/2012/10/500-internet-server-error-for-incorrect-permissions-after-installing-suphp-and-uploading-php-script.html

chmod /forums/ 本身为 755 后,mydomain.com/forums/ 可以正确访问,没有任何错误。

【讨论】:

    【解决方案2】:

    我的 magento 安装似乎没有这个问题。尝试在 docroot 中创建一个测试文件夹并在其中放置一个 index.php 文件。然后导航到 mydomain.com/test/,您应该会看到 index.php 的内容。还要检查您的 magento .htaccess 文件是否包含以下几行:

    ## never rewrite for existing files, directories and links
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
    

    也许您的论坛有自己的 .htaccess 导致 404?您的论坛可能需要指定

        RewriteBase /forum/
    

    【讨论】:

    • 谢谢你,杰米。似乎是权限问题。
    猜你喜欢
    • 2011-01-30
    • 1970-01-01
    • 2016-06-21
    • 1970-01-01
    • 2011-09-17
    • 1970-01-01
    • 2012-09-28
    • 2016-04-30
    • 2012-10-08
    相关资源
    最近更新 更多