WordPress’ .htaccess rules Decoded

If your WordPress’ .htaccess file has not been modified it should look like this:

# BEGIN WordPress / # END WordPress Tags

WordPress may modify anything within these two tags and anything you add should be outside of these tags.  Source: WordPress Codex

<IfModule mod_rewrite.c> / </IfModule> Tags

If your server doesn’t have the rewrite module or it isn’t properly enabled, the rewrite rules with the If tags will not be executed. Sources: WordPress Codex Using_Permalinks, Glossary

RewriteEngine On

The RewriteEngine directive enables or disables the runtime rewriting engine. Source: Apache documentation

RewriteBase /

The RewriteBase directive allows you to define a root directory for your website.  Source: RationalSpace RewriteBase Explained

RewriteRule ^index\.php$ – [L]

Prevents requests for index.php from being rewritten, to avoid infinite loops. If the request is for index.php the directive does nothing – and stops processing rules [L]. Source: StackOverflow

[L] flag

The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed. Source: Apache documentation

-f and -d flags

These Rewrite Condition flags allow you to perform various file attribute tests

Is regular file.
Treats the TestString as a pathname and tests whether or not it exists, and is a regular file.

Is directory.
Treats the TestString as a pathname and tests whether or not it exists, and is a directory.

Source: Apache documentation

The remaining code:

Are rules that are processed in order.  First it checks for a filename, then it checks for a directory, and if both of those fail the request is redirected to index.php. Source: SitePoint