32

I have setup a virtualhost like following

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

But always throws me

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

I'm a bit confused because I understand that is the right place to do it

1 Answer 1

70

It's because you have to put it in <Directory> directive.' .htaccess is per directory context, so you have to explicitly tell apache where .htaccess is allowed to be used.

<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>
3
  • You're right. thanks I forget about that. I have long time without use apache
    – rkmax
    Feb 19, 2016 at 15:20
  • 1
    Thats really nice one bro Mar 25, 2017 at 17:10
  • I have AllowOverride All within the Directory directive but still get AllowOverride not allowed errors and a 500 Internal Server error on the site.
    – DonP
    Sep 7, 2022 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.