Are mod_rewriteModule mod_rewrite tags redundant in .htaccess mod_rewrite files

Are the following open / close tags necessary for .htaccess mod_rewrite? I had a .htaccess that works without them, but just checking out the htaccess tutorials, many of them include this tag.

<IfModule mod_rewrite.c> ... </IfModule> 
+6
url url-rewriting apache .htaccess mod-rewrite
source share
1 answer

They are not needed for mod_rewrite, because unknown directives are not interpreted, so this is more or less style.

The tag can also be used to test unavailable modules with <IfModule !mod_rewrite.c> , so you can use some other directives in this case.

+9
source share

All Articles