WORDPRESS .HTACCESS FILE EXPLAINED!

WordPress’ .htaccess file explained

If you have configured your WordPress system to use pretty permalinks the following will be added to the .htaccess file:

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Explaining the .htaccess, row by row

<IfModule mod_rewrite.c>
This line checks if the mod_rewrite module is available on the server. If not, none of the enclosed Rewrite commands will be processed.

RewriteEngine On
This directive enables the runtime rewriting engine.

RewriteBase /
Let’s the server know that the .htaccess was reached via / and not through any other path prefix.

RewriteCond %{REQUEST_FILENAME} !-f
This condition is true if the the path REQUEST_FILENAME not refers to an existing file.

RewriteCond %{REQUEST_FILENAME} !-d
This condition is true if the the path REQUEST_FILENAME not refers to an existing directory

RewriteRule . /index.php [L]
If the two RewriteCond’s listed above evaluated to true the server will load index.php. [L] indicates that no further rewrite rules should be processed.
If any of the RewriteCond’s evaluated to false, the server will load the actual file or directory instead of index.php.

SOURCE: http://rogerkar.blogspot.com/2009/04/wordpress-htaccess-file-explained.html
SOURCE TO UNDERSTAND THE SYNTAX ABOVE IN APACHE: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
Advertisements
This entry was posted in WORDPRESS. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s