Apache error on SuSE : Invalid command RewriteEngine, perhaps misspelled

apache-2.4mod-rewriteslesvirtualhost

Webserver: Apache 2.4 on SuSE 12, multiple vhosts

4 vhosts (2 ssl, 2 http) have RewriteEngine on and some simple rewrite rules.

mod_rewrite is available and active (checked with a2enmod -l)

Problem: if I issued a httpd -t to check the syntax, I received for the two http vhosts a warning:

AH00526: Syntax error Invalid command 'RewriteEngine', perhaps misspelled
or defined by a module not included in the server configuration

After having added <IfModule mod_rewrite.c></IfModule> lines around the rewrite blocks the warning disappeared.

Question: Why is there no warning with respect to the two ssl vhosts, which also have the RewriteEngine on, but no enclosing IfModule lines?

Best Answer

Uncomment this line in your apache config, or add it if it doesn't exist:

LoadModule rewrite_module modules/mod_rewrite.so

Restart apache.