Yes, you can just have the
RewriteRule directives. You do not need to repeat the
<IfModule mod_rewrite.c> wrapper or the
You only require the
<IfModule mod_rewrite.c> wrapper here if your directives are "optional" to the running of your site and you intend to copy these same directives verbatim on many sites where mod_rewrite might not be available - which is the case with the WordPress code block. If mod_rewrite is not available then WordPress still "works", you just don't get the same "pretty" URLs.
See my answer to the following Webmasters question that goes into detail about why the
<IfModule mod_rewrite.c> wrapper is "probably" not required.
With regards to the
RewriteEngine directive... only the very last instance of the
RewriteEngine directive does anything - and this controls the entire file. So if you repeat the
RewriteEngine On directive, above the WordPress code block, it's not going to do anything anyway and is essentially ignored. In fact, it is arguably misleading since it gives the impression you can disable the rewrite engine just for your code block - you can't.
If you are manually writing all your
.htaccess file then ideally you would just have one
RewriteEngine On directive at the top (just because that's more readable - but the order does not strictly matter).
The reason why you typically see multiple
RewriteEngine directives in a "WordPress"
.htaccess file is that many of the directives are written by WordPress itself (or plugins) without knowledge of what other directives are already in the file - so adding
RewriteEngine On is unavoidable. (Plus the fact that developers have a habit of blindly copy/pasting
.htaccess code blocks and/or it's used out of habit perhaps from a misunderstanding to how Apache config files are processed.)
You could write a
RewriteEngine Off directive at the very end of the file and this would disable the rewrite engine for the entire file, despite there being
RewriteEngine On directives earlier in the file - these are essentially ignored. This is actually a quick way to "comment out" all the mod_rewrite directives, rather than manually using
# in front of every directive.
So, if the
# BEGIN WordPress block is still in place (with it's
RewriteEngine On directive) - which you should not edit (as you've stated) - then there is no need to repeat the
RewriteEngine On directive if you create your own custom redirects above this.
The same principles apply to the
RewriteBase directive as well... the last instance wins and controls the entire file.
After writing this I've found an answer I wrote a while back to a related question, which covers some additional points: