【发布时间】: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