无法在 Lion Apache 上启用 htaccess 支持
我使用 MAMP 运行了一段时间,但后来我开始想,深入了解 Apache 本身也没什么坏处。
因此,默认选项对我来说非常有用,甚至还启用了几个虚拟主机,而且它们工作得很好。但是,我无法让 Apache 支持我的 htaccess 文件。
这是我的 Apache 配置 https://gist.github.com/1332527 以及我的虚拟主机配置https://gist.github.com/1332542
我的网站位于例如 min.local/index.php/some-url 但在 min.local/some-url 处失败,出现 404 错误。我读过很多关于在 httpd.conf 中将 AllowOverride 设置为 All 的博客文章,但它没有没有什么不同。
我的 .htaccess 文件很好,它可以在生产中使用。
有什么建议吗?
谢谢, 史蒂文
I was running with MAMP for a while but then got to thinking that it wouldn't hurt to get into the bones of Apache itself.
So the default options worked great for me, even enabled a couple of virtual hosts too and they work great. However, I can't get Apache to support my htaccess files.
This is my Apache config https://gist.github.com/1332527 with my virtual host config as well https://gist.github.com/1332542
My sites work at min.local/index.php/some-url for example but fail at min.local/some-url where I get a 404. I've read a number of blog posts about setting AllowOverride to All in httpd.conf but it hasn't made a difference.
My .htaccess file is fine, it works in production.
Any suggestions?
Thanks,
Steven
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另外,请确保查看位于 /etc/apache2/users/username.conf 的用户特定的conf 文件并在那里设置AllowOverride。
那里的设置将覆盖 httpd.conf 中的默认设置,
只需将其设置为 All 或 httpd 中的任何内容即可
Also, make sure to look at your user-specific conf file, located at /etc/apache2/users/username.conf and set your AllowOverride there.
The settings there will override the defaults in httpd.conf
just set it to All or whatever you have in httpd
我怀疑虚拟主机文件中的
AllowOverride None
覆盖了主配置文件中的AllowOverride All
。尝试将其更改为All
,看看会发生什么。I suspect the
AllowOverride None
in the virtual host file is overriding theAllowOverride All
in the main config file. Try changing it toAll
and see what happens.我有完全相同的问题。在我的虚拟主机块中,我必须添加
On restarting apache (sudo apachectl restart) 一切都很好。
I had exactly the same issue. In my vhost block I had to add
On restarting apache (sudo apachectl restart) all was good.