在本地计算机上为.htaccess提供AllowOverride,给出403 Forbidden

时间:2011-04-20 21:49:25

标签: apache configuration

我有一个mod_rewrite我想在我的Mac上本地使用但是当我将配置改为我的目录标签时,我得到403 Forbidden错误。我已经尝试了所有其他解决方案,但没有运气。

也许有人会看到我不是......

以下是代码:

的httpd.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "/Library/WebServer/Documents/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

myusername.conf

覆盖了哪些内容
<Directory /Users/adrianmaurer/Sites/www>
    Options Indexes MultiViews FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

虚拟主机文件httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /Users/adrianmaurer/Sites/www
    ServerName myserver.dev
</VirtualHost>

1 个答案:

答案 0 :(得分:26)

我能够通过设置我的/etc/apache2/users/username.conf文件来修复它(注意你也必须更改Options行,而不仅仅是AllowOverride):

<Directory "/Users/tlhunter/Sites/">
    Options All               
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>