JIYIK CN >

Current Location:Home > Learning > NETWORK >

Apache's AllowOverride All doesn't do what you think

Author:JIYIK Last Updated:2025/03/17 Views:

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 MultiViewsby 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 IRCI 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, Allparameter doesn't really mean "**[Allow overriding] all options** ", because it doesn't include MultiViewsthe 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.

Article URL:

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

在 Apache2 中启用 PHP

Publish Date:2023/03/27 Views:207 Category:PHP

本文将教你如何使用 a2enmod、LoadModule 和符号链接在 Apache2 中启用 PHP。如果你遇到有关 PHP 的模块错误,我们将教你如何通过 apt-get 修复它。

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial