Apache's AllowOverride All doesn't do what you think
I just had to set up an Apache server for a school project. Since I like to use .htaccess
./batch files to set up rewrite rules and fiddle with some other options, I had to load some extra modules in addition to the standard batch processing.
phpinfo()
You can easily check which modules are currently loaded using , as described in this article about enabling mod_rewrite in Apache .
Activating an Apache module is easy: just open the httpd.conf file in the /conf/ folder of your Apache installation and uncomment (or add) the appropriate lines. Comment lines always begin with a pound sign ( ).
#
Basically, to load mod_negotiation
(for multiviews) and mod_rewrite
(for rewrite rules), we just need to add the following lines to httpd.conf :
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
So far, so good. Apache has been instructed to load the additional modules; we should now be able to use the and rewrite rules MultiViews
by defining them in a ./configure_modules file..htaccess
However, when I try to use Options +MultiViews
, all I get is one of those infamous " 500 Internal Server Error " pages.
The error log said something along the lines of .htaccess: Option MultiViews not allowed here .
Google didn't really help in this case. At first, I could only find people with the same problem. #apache IRC
I couldn't find any solutions until I really started looking through old logs.
It turns out that Apache has a default setting in httpd.conf that specifies settings that can be overridden by content written to a .htaccess file: AllowOverride
. Our httpd.conf might contain something like this:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
Contrary to what we might think, All
parameter doesn't really mean "**[Allow overriding] all options** ", because it doesn't include MultiViews
the options! The key here is the use of AllowOverride Options=All,MultiViews
. Together with all the other directive groupings, this is the code we need:
<Directory />
Options FollowSymLinks
AllowOverride AuthConfig FileInfo Indexes Limit Options=All,MultiViews
Order deny,allow
Deny from all
</Directory>
For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.
Related Articles
解决 Java 异常 Unable to Instantiate org.apache.hadoop.hive.ql.metadata.Sessi
Publish Date:2023/07/14 Views:255 Category:Java
-
本篇文章介绍如何解决 java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient。Apache Hive 是一款开源数据仓库软件,用于读取、管理和写入存储在 Hadoop 文件中的大
解决 Java 错误 Java.Lang.NoClassDefFoundError: Org/Apache/Commons/Logging/Log
Publish Date:2023/07/11 Views:168 Category:Java
-
本篇文章介绍了 Java 中的 java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory 错误。解决java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
在 Apache2 中启用 PHP
Publish Date:2023/03/27 Views:204 Category:PHP
-
本文将教你如何使用 a2enmod、LoadModule 和符号链接在 Apache2 中启用 PHP。如果你遇到有关 PHP 的模块错误,我们将教你如何通过 apt-get 修复它。
在 Ubuntu 和 Debian 上配置 Apache Web 服务器
Publish Date:2023/03/17 Views:187 Category:操作系统
-
本教程展示了在 Ubuntu 和 Debian 上安装和设置 apache 网络服务器以及使用访问日志。
在同一台服务器上运行 Node Js 和 Apache
Publish Date:2023/03/12 Views:291 Category:Node.js
-
本教程演示了如何在同一台服务器上运行 Node JS 和 Apache。
Apache 的 AllowOverride All 并不像你想象的那样
Publish Date:2023/01/06 Views:197 Category:网络
-
我只需要为一个学校项目设置一个 Apache 服务器。 因为我喜欢使用 .htaccess 文件来设置重写规则并摆弄一些其他选项,所以除了标准批处理之外还必须加载一些额外的模块。 使用 phpin
从URL中移除 www.
Publish Date:2023/01/06 Views:157 Category:学无止境
-
如果你讨厌网站 URL 中的 www. 部分(就像我大约两个月前开始做的那样),你应该让其他人包括搜索引擎知道这一点。 这只是将通过 www. 访问的每个页面重定向到与其相等的 非www 的
如何在 Ubuntu 18.04 VPS 或专用服务器上启用 Apache Mod_Rewrite
Publish Date:2023/01/06 Views:163 Category:学无止境
-
Mod_rewrite 是一个强大的 Apache 模块,提供 URL 操作能力。 复杂的功能允许网站管理员重写 URL,这是许多内容管理系统编码(如 WordPress)中的常见做法。 Mod_rewrite 以翻译动态网站中人类
php zookeeper常见问题解决方案
Publish Date:2017/03/13 Views:932 Category:PHP
-
本章承接上一章提出的php-zookeeper的问题以及原因来继续提出解决方案,一是修改php-zookeeper源码,再就是修改php代码。