[wp-hackers] rewrite technique

Andy Skelton skeltoac at gmail.com
Mon Oct 24 02:41:57 GMT 2005

Kai: IIUC, WP 1.6 uses mod_rewrite to send all unmatched requests to
index.php, complete with the original request URI.

WP then builds an array of expressions, sends it through a filter and
then tests the rules against the request URI. When it finds a match,
it sends the parts of the URI on as query vars, e.g. year, month, day,
post name.

One of the very nice things about this is that WP doesn't need to
update .htaccess every time the rewrite rules change. The rules are
generated dynamically, so a plugin can easily add any new rules in a
filter. The plugin doesn't have to mess with .htaccess.

Now, if you're ever going to understand WP-Rewrite, you're going to
have to dig into the code. Start by finding a way to make WP print the
array of rules.

Actually, no, that's not right. Start by walking to the market and
buying three live chickens. ;-)


More information about the wp-hackers mailing list