First you should really understand what those rules are doing and what you really want to achieve. Then you can try to change the system to fit your needs.
IfModule
ensures everything inside is processed only when mod_rewrite Apache module is present. All the other directives are from this module.
RewriteEngine On
enables URL rewriting.RewriteBase /
tells the engine that the rules operate inside root. See also the general question on howRewriteBase
works.RewriteRule ^index\.php$ - [L]
means that no more rules should be processed ([L]
) if the current URL to be rewritten isindex.php
. No rewrite takes place.RewriteRule
directive accepts a regex. See also regex tag here on SO.- All
RewriteCond
directives apply to the followingRewriteRule
. Unless[OR]
flag is added, they must be all satisfied at the same time to execute the rule. In this case they mean:- Requested resource is not a regular file.
- Requested resource is not a directory.
- Rewrite any (at least one character long) URL to
index.php
. This is the last ([L]
) rule to be processed.
When adding new RewriteRule
s, you probably want to use the WordPress way of doing this, as described in Zac’s answer. Figuring out the right rule by analogy to the many examples in the manual or here on SO should not be hard.