【问题标题】:AllowOverride not allowed here此处不允许 AllowOverride
【发布时间】:2016-02-19 15:16:17
【问题描述】:

我已经设置了如下虚拟主机

<VirtualHost *:80>
  DocumentRoot /var/www/html
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  Options Includes
  AllowOverride All
</VirtualHost>

但总是扔给我

AH00526: Syntax error on line 6 of /etc/apache2/sites-enabled/000-my-site.conf:
AllowOverride not allowed here

我有点困惑,因为我知道这样做是正确的地方

【问题讨论】:

    标签: apache


    【解决方案1】:

    这是因为你必须把它放在&lt;Directory&gt; 指令中。' .htaccess 是每个目录上下文,所以你必须明确告诉 apache 在哪里允许使用 .htaccess。

    <VirtualHost *:80>
      DocumentRoot /var/www/html
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
      Options Includes
      <Directory "/var/www/html">
      AllowOverride All
      </Directory>
    </VirtualHost>
    

    【讨论】:

    • 你是对的。谢谢,我忘记了。好久没用apache了
    • 这真是个好兄弟
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-31
    • 2015-07-16
    • 2021-11-07
    • 2013-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多