AllowOverride for .htaccess 在本地机器上给出 403 Forbidden [英] AllowOverride for .htaccess on local machine giving 403 Forbidden

查看:24
本文介绍了AllowOverride for .htaccess 在本地机器上给出 403 Forbidden的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 mod_rewrite,我想在我的 mac 本地使用,但是当我将配置更改为在我的目录标记中时,我收到 403 Forbidden 错误.我已经尝试了所有其他解决方案,但没有成功.

I have a mod_rewrite I'd like to use locally on my mac but when I change my configuration to in my directory tag I get a 403 Forbidden error. I've tried all the other solutions around but no luck.

也许有人会看到我看不到的东西...

Maybe somebody will see something I am not...

代码如下:

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 覆盖

Which is overridden by myusername.conf

<Directory /Users/adrianmaurer/Sites/www>
    Options Indexes MultiViews FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

虚拟主机文件 httpd-vhosts.conf

Virtual host file httpd-vhosts.conf

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

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

推荐答案

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

I was able to get it fixed by setting my /etc/apache2/users/username.conf file like so (Note you have to change the Options line too, not just the AllowOverride):

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

这篇关于AllowOverride for .htaccess 在本地机器上给出 403 Forbidden的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆