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
Issues to note when installing Apache on Linux
Publish Date:2025/04/08 Views:78 Category:OPERATING SYSTEM
-
As the most commonly used web server, Apache can be used in most computer operating systems. As a free and open source Unix-like operating system, Linux and Apache are a golden pair. This article will introduce the installation and use of A
Apache2.4 installation and precautions under Windows7
Publish Date:2025/04/08 Views:125 Category:OPERATING SYSTEM
-
To install apache2.4 in Windows 7, we first need to download the apache2.4 installation program. Here we download the software from the apache official website http://httpd.apache.org/download.cgi . First, let's see how to download apache2.
Apache2.4+PHP5.6 environment configuration under Windows7
Publish Date:2025/04/07 Views:103 Category:OPERATING SYSTEM
-
I upgraded my Windows 7 32-bit operating system to a 64-bit operating system, and the previous PHP environment also needed to be reconfigured. Previously, I used apache2.2 and php5.3. Since I upgraded the operating system, I also upgraded t
Configuring Apache Web Server on Ubuntu and Debian
Publish Date:2025/04/05 Views:176 Category:OPERATING SYSTEM
-
This article shows you how to install Apache web server on Ubuntu and Debian, set it up, and access the access logs. Apache Web Server in Ubuntu and Debian Apache HTTP Server is a free and open source web server that is very popular. More t
解决 Java 异常 Unable to Instantiate org.apache.hadoop.hive.ql.metadata.Sessi
Publish Date:2023/07/14 Views:257 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:169 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:207 Category:PHP
-
本文将教你如何使用 a2enmod、LoadModule 和符号链接在 Apache2 中启用 PHP。如果你遇到有关 PHP 的模块错误,我们将教你如何通过 apt-get 修复它。
在 Ubuntu 和 Debian 上配置 Apache Web 服务器
Publish Date:2023/03/17 Views:190 Category:操作系统
-
本教程展示了在 Ubuntu 和 Debian 上安装和设置 apache 网络服务器以及使用访问日志。
在同一台服务器上运行 Node Js 和 Apache
Publish Date:2023/03/12 Views:293 Category:Node.js
-
本教程演示了如何在同一台服务器上运行 Node JS 和 Apache。