I'm getting in my server error log.

[Mon Jan 27 08:04:06 2014] [alert] [client x.x.x.x] /home/.../public_html/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

And here is my simple .htaccess:

<IfModule mod_rewrite.c>
    Options -MultiViews
    php_flag display_startup_errors on
    php_flag display_errors on
    php_flag html_errors on
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ silex.php/ [L]

What could be wrong?

  • Post your apache2.conf (or httpd.conf, whichever has the most info), please. – Nathan C Jan 27 '14 at 14:17
  • Went to /etc/apache2, nothing in httpd.conf – MikeOscarEcho Jan 27 '14 at 14:27
  • @NathanC Sorry forgot to mention I don't know how to copy text from vim to ubuntu clipboard. Looked it up but don't have time to configure right now. I ended up deleting .htaccess. It was actually placed in the wrong directory before getting to where my main web files were located which caused the error. Thanks for the help either way! – MikeOscarEcho Jan 27 '14 at 15:10

It might be because mod_headers is not enabled. Try running a2enmod headers to enable the module.

| improve this answer | |
  • Just enabled and restarted server but still getting the error. It was working before but I was tinkering with the .htaccess for caching. I took out all the previous code I had in there and just left the original (which was working) and now I keep getting this error. – MikeOscarEcho Jan 27 '14 at 13:18
  • sudo a2enmod headers and then sudo service apache2 restart solved the issue for me on Ubuntu. – Johano Fierra Oct 20 '18 at 8:52

Did you enable apache mod_headers ?

a2enmod mod_headers

| improve this answer | |
  • Yep just did that based on Nils comment. Didn't solve the issue. – MikeOscarEcho Jan 27 '14 at 13:24

Enable header module using below command

sudo a2enmod headers

You have to restart your apache once you are done with enabling module

sudo service apache2 restart

| improve this answer | |

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.