Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
768 views
in Technique[技术] by (71.8m points)

apache - .htaccess file not being read ("Options -Indexes" in .htaccess file not working)

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

Options -Indexes

However, the index is still shown for the directory.

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

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

EDIT:

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You should check that the Apache config allows for the .htaccess to be executed. In your virtualhost config, there should be a line:

AllowOverride All

If there isn't, that's why the .htaccess isn't taking effect.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...