【发布时间】:2014-05-02 12:46:27
【问题描述】:
我正在使用 OSX 上的内置 Apache2。我将文档根目录移动到桌面上的文件夹中,并确保 _www 和 everyone 具有读取权限。它工作得很好,PHP 工作得很好,一切正常,直到我只用这一行添加 .htaccess:
RewriteEngine on
一旦我这样做了,文件所在目录中的所有内容都是 403 Forbidden:
Forbidden
You don't have permission to access /dir/file.txt on this server.
Apache 日志显示此错误:
[error] [client 127.0.0.1] 选项 FollowSymLinks 或 SymLinksIfOwnerMatch 关闭,这意味着禁止 RewriteRule 指令:/Users/ uname/Desktop/localhost/dir/filename.txt
我已经通过httpd.conf 并确保我已启用FollowSymLinks 无济于事:
DocumentRoot "/Users/uname/Desktop/localhost"
<Directory />
Options FollowSymLinks
Options SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/uname/Desktop/localhost">
Options FollowSymLinks
Options SymLinksIfOwnerMatch
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
如果我在.htaccess 文件中注释掉RewriteEngine on,那么显然一切正常,除了重写规则。在 OSX 10.8.5 上,httpd.conf 位于 /etc/apache2 中,该文件夹还有 users 文件夹,其中包含用于使用的各个文件,例如uname.conf,但我在这里添加了符号链接,与另一个相同。我注意到还有一个文件夹extra 包含httpd-userdir.conf 之类的文件,但它们似乎没有禁用任何东西。
FollowSymLinks 还有什么地方可以打开(或关闭)?
【问题讨论】:
标签: apache mod-rewrite apache2 symlink httpd.conf