相关疑难解决方法(0)

打开 RewriteEngine 会产生 403 错误——如何打开 FollowSymLinks?

我正在 OSX 上使用内置的 Apache2。我将文档根目录移动到桌面上的一个文件夹中,并确保它_www具有everyone读取权限。它工作得很好,很棒,PHP 工作,一切工作正常,直到我.htaccess仅添加以下行:

RewriteEngine on
Run Code Online (Sandbox Code Playgroud)

一旦我这样做,包含该文件的目录中的所有内容都是 403 Forbidden:

Forbidden
You don't have permission to access /dir/file.txt on this server. 
Run Code Online (Sandbox Code Playgroud)

Apache 日志显示此错误:

[错误] [客户端 127.0.0.1] 选项FollowSymLinksSymLinksIfOwnerMatch已关闭,这意味着禁止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>
Run Code Online (Sandbox Code Playgroud)

RewriteEngine on如果我在文件中注释掉.htaccess …

apache mod-rewrite symlink apache2 httpd.conf

5
推荐指数
1
解决办法
3260
查看次数

标签 统计

apache ×1

apache2 ×1

httpd.conf ×1

mod-rewrite ×1

symlink ×1