【问题标题】:Magento .htaccess file RewriteBase setting?Magento .htaccess 文件 RewriteBase 设置?
【发布时间】:2013-12-17 12:41:19
【问题描述】:

我已经解决了在为现有的实时 Magento 商店设置暂存环境时遇到的问题。但我不明白为什么它会起作用以及为什么我的现场网站上没有问题。

这是我遇到的错误,每当我尝试离开我的站点登台主页时,我都会收到 500 内部服务器错误

在错误日志中我得到了这个:

[Tue Dec 17 01:12:52 2013] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Tue Dec 17 12:56:17 2013] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://localhost.mysite.com/

有了一点research online,我通过将.htaccess 文件RewriteBase 设置更改为RewriteBase / 解决了这个问题。在我的实时站点上,此设置被注释为 #RewriteBase /magento/

  1. 为什么只有在我的暂存环境中才需要此设置?
  2. 是否也应该在现场环境中使用,还是应该避免使用 完全?
  3. 我在 Ubuntu 上的 Apache2 服务器上本地运行该站点 机器,也许它与我的本地服务器设置有关?

【问题讨论】:

    标签: apache .htaccess magento redirect internal-server-error


    【解决方案1】:

    为什么仅在我的暂存环境中才需要此设置?

    可能是因为您的暂存环境位于文档根目录内名为/magento/ 的目录中。当您进行以下检查时:

    RewriteCond %{REQUEST_FILENAME} !-f
    

    并且基础错误,检查文件是否存在失败。 base 用于附加到相对 URL 路径的开头。因此,如果您的文件位于 /magento/ 中,那么如果没有正确的基础,您的检查将失败并且您的规则将无限循环(或直到达到内部递归限制)。在您的生产环境中,这些文件可能位于您的文档根目录中,因此基础并非完全必要,因为规则与您要重写的文件位于同一目录中。

    至于其他 2 个问题,如果不查看您的所有规则和所有设置,就无法回答。

    【讨论】:

      猜你喜欢
      • 2012-03-14
      • 2013-08-27
      • 2011-01-26
      • 2013-05-17
      • 2020-06-21
      • 1970-01-01
      • 2015-11-16
      • 1970-01-01
      相关资源
      最近更新 更多