Short answer: This error means you forgot to enable the rewrite
module and is not related to ErrorDocument
.
How to fix it?
Make sure you have enabled the rewrite
module. This can be done by doing one of the following:
- Uncommenting
LoadModule rewrite_module modules/mod_rewrite.so
in your Apache configuration file.
- Run
a2enmod rewrite
as root (only available on Debian-based systems).
Why are you only getting this error after you added ErrorDocument?
AllowOverride
was set to None
, which means your .htaccess will be completely ignored. Later, you set it to All
to enable .htaccess files.
However, you forgot to enable the rewrite
module but you tried to use it in your .htaccess. This is not related to ErrorDocument
and is simply a coincidence. The following error you posted is clearly showing it:
[Sat Aug 17 17:33:46 2013] [alert] [client 127.0.0.1] C:/Data/MyWeb/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration