【问题标题】:multiple htaccess file complication多个 htaccess 文件的复杂性
【发布时间】:2013-09-05 15:32:56
【问题描述】:

我有一个 magento 网上商店,在他的基本 .htaccess 文件中有以下规则:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php [L]

现在我在网店根目录中有一个名为“oscware”的子目录。此文件夹中还有一个 htaccess 文件,内容如下:

AuthType Basic
AuthName "Please enter your ID and password"
AuthUserFile .htpasswd
require valid-user

如果我想连接到 http://www.example.com/oscware/oscware-connector.php,我将被重定向到 magento 商店,并出现错误 404。

如果我删除规则

RewriteRule .* index.php [L] 

它有效。好的,每个人都应该认为问题出在重写条件下。但事实并非如此。因为在另一边,如果我删除规则

require valid-user

在 oscware 目录的 .htaccess 文件中它也可以工作(使用规则

RewriteRule .* index.php [L]

)

最后我只能在 webshop-root 中编辑 magento .htaccess,因为 oscware .htaccess 是自动生成的。有没有人想办法让这个场景发挥作用?

提前致谢!

【问题讨论】:

  • 我已经通过 .htaccess 文件中的以下语句解决了这个问题:ErrorDocument 401 test.html

标签: .htaccess magento


【解决方案1】:

不知道为什么会这样。我唯一能想到的可能是缺少内部 401 页面,这以某种方式导致文档根目录中的规则被应用。除非“oscware”或magento中有其他规则或重定向无意中导致了这种情况。

但是尝试,在“oscware”文件夹中的 htaccess 文件中,打开重写引擎:

RewriteEngine On

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-01
    • 1970-01-01
    • 2015-05-11
    • 1970-01-01
    • 2021-02-17
    • 2021-07-10
    • 2011-12-21
    • 1970-01-01
    相关资源
    最近更新 更多