.htaccess适用于虚拟主机,但不适用于public_html

问题是当我有一个docroot指向某些用户的public_html / *。 说有一个虚拟主机与Docroot /家庭/用户/ public_html / www – 那里的.htaccess的作品。 然而,当我去example.com/~user/www .htaccess不起作用,Apache甚至没有阅读(我通过创build乱码的内容testing)。

我为userdir的configuration是:

<IfModule mod_userdir.c> UserDir public_html UserDir disabled root <Directory /home/*/public_html> Options MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec AllowOverride All <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> </IfModule> 

对于鬼魂:

 <VirtualHost *:80> ServerName example.com DocumentRoot /home/user/public_html/www </VirtualHost> 

.htaccess在/ home / user / public_html / www

当我遇到问题时,我除了使用Directory指令backet外,还使用了Location指令括号。