One of Apache's more powerful features - and also one of its least-knownones - is its URL rewriting module, which makes it possible to manipulateURLs using a rule-based rewriting engine in combination with regularexpressions.
Apache's URL rewriting engine was originally developed by Ralf Engelschallin 1996. He handed it over to the Apache developers, who integrated it intothe Web server, and it's been part and parcel of it since then.Note, however, that the engine needs to be compiled into the server to useit - so if you plan on trying out any of the examples below, you may needto re-compile your server with the mod_rewrite module first.
The basis of the mod_rewrite module is rulesets and conditions, which maybe specified in either the main "httpd.conf" configuration file or theper-directory ".htaccess" file. When the server receives a HTTP request,the rewriting engine begins checking for a matching ruleset; if it finds amatch, it substitutes the rewritten URL for the original one.
It's also possible to add conditions to specific rules - in this case, oncea ruleset is matched, the conditions attached to it are checked, and URLsubstitution occurs if they are found to be valid.
Rewriting rules are specified with the RewriteRule directive, whileconditions are specified with the RewriteCond directive. RewriteConddirectives need to precede RewriteRule directive.