Nested <IfModule>
containers are not your problem (yes, this is possible). (But is the outer <IfModule mod_rewrite.c>
container necessary?)
Your problem is the RewriteRule
pattern ^/mod_gzip/?$
:
RewriteRule ^/mod_gzip/?$ mod_gzip-is-enabled.php
This will never match in a per-directory .htaccess
context, because of the slash prefix on the RewriteRule
pattern. You need to remove it, like so:
RewriteRule ^mod_gzip/?$ mod_gzip-is-enabled.php [L]
In order to match a requested URL of the form /mod_gzip/
(or /mod_gzip
).
In per-directory .htaccess
files, the URL-path that the RewriteRule
pattern matches against is less the directory-prefix, which notably ends with a slash. So the URL-path that is matched never starts with a slash. (This differs from when the directives are used in a server or virtualhost context.)
Also, you should probably include the L
flag in case you have other directives.