2

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?

MarkHelms
  • 181
  • 5
  • 16
  • Do the two SSL vhosts work correctly on the appropriate port? – MrWhite Jul 12 '18 at 09:35
  • In what order are the various config files loaded? If the http host configs are loaded before the mod_rewrite module, but the ssl hosts are loaded after, that would eplain it. – Jenny D Jul 12 '18 at 13:11

1 Answers1

1

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

LoadModule rewrite_module modules/mod_rewrite.so

Restart apache.

eeijlar
  • 323
  • 3
  • 7
  • What difference would this make? According to "a2enmod -l" this module is already loaded. The line you proposed is also not set in the ssh-vhosts, and httpd -t does not complain about them... – MarkHelms Jul 13 '18 at 10:47
  • 1
    https://stackoverflow.com/q/10144634/1028276 – eeijlar Jul 13 '18 at 11:53