虚拟主机不读取.htaccess

我刚刚创build了虚拟主机

<VirtualHost myvirtualhost:80> ServerAdmin webmaster@myvirtualhost ServerName myvirtualhost DocumentRoot /home/myname/sites/public_html <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/myname/sites/public_html/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> 

它的工作原理,但它不能读取public_html中的.htacces文件:

 DirectoryIndex otherindex.php 

我试图改变所有的AllowOverride,但我得到500错误。 我怎样才能解决这个问题 ? 谢谢。

mod_dir是否被激活?

http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex

你也需要在你的allowoverride指令中更广泛,你至less应该把“AllowOverride Indexes”

http://httpd.apache.org/docs/current/fr/mod/core.html#allowoverride