.htaccess文件不被读取("选项-Indexes"在.htaccess文件无法正常工作) [英] .htaccess file not being read ("Options -Indexes" in .htaccess file not working)

查看:435
本文介绍了.htaccess文件不被读取("选项-Indexes"在.htaccess文件无法正常工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个.htaccess文件,只有下面一行:

I created an .htaccess file with only the following line:

选项-Indexes

Options -Indexes

不过,该指数仍显示该目录。

However, the index is still shown for the directory.

我刚安装的Apache2和我使用所有默认设置(我没有修改apache2.conf或httpd.conf文件)。

I just installed Apache2 and am using all the defaults (I did not modify apache2.conf or httpd.conf).

OS:的Ubuntu 12.04(precise穿山甲)
Apache2的版本:服务器版本:阿帕奇/ 2.2.22(Ubuntu的)服务器建:2012年2月13日1时51分56秒

OS: Ubuntu 12.04 (Precise Pangolin)
Apache2 version: Server version: Apache/2.2.22 (Ubuntu) Server built: Feb 13 2012 01:51:56

$ ls -l命令的.htaccess
  -rwxr-XR-X的.htaccess

$ ls -l .htaccess
-rwxr-xr-x .htaccess

编辑:

我把lanzz的建议,并添加胡言乱语到的.htaccess 文件,发现的.htaccess 文件不被读取。

I took lanzz's advice and added gibberish to the .htaccess file, and discovered that the .htaccess file is not being read.

推荐答案

要得到这个工作,我增加了以下为 /etc/apache2/httpd.conf (其中是在Apache安装时默认设置),然后重新启动Apache的一个零长度文件。根据需要现在选项-Indexes 的.htaccess 文件工作。这里所需的最低限度,以得到它的工作:

To get this working, I added the following to /etc/apache2/httpd.conf (which is a zero-length file by default when Apache is installed) and then restarted Apache. Now Options -Indexes in the .htaccess file works as desired. Here is the bare minimum required to get it to work:

/etc/apache2/httpd.conf:

<VirtualHost *:80>
        DocumentRoot /var/www
        <Directory / >
        </Directory>
</VirtualHost>

lanzz 的建议,乱码添加一行到的.htaccess 文件,看它是否正在读是有帮助诊断问题。

lanzz's suggestion to add a line of gibberish to the .htaccess file to see if it was being read was helpful in diagnosing the problem.

注意 AllowOveride 默认为所有,每次的埃文Mulawski 的评论,所以它不是必需的组的httpd.conf 线以上的很少。

Note that AllowOveride defaults to All, per Evan Mulawski's comment, so it's not required in the minimal set of httpd.conf lines above.

这篇关于.htaccess文件不被读取(&QUOT;选项-Indexes&QUOT;在.htaccess文件无法正常工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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