[wp-hackers] rewrite technique

Graeme Lennon graeme at samurai.com
Mon Oct 24 01:02:08 GMT 2005


``Despite the tons of examples and docs, mod_rewrite is voodoo. Damned
cool voodoo, but still voodoo.''

g.

Owen Winkler wrote:
> Kai Hendry wrote:
>> I tested out 1.6 alpha and I noticed while making permalinks the
>> generated .htaccess looked like:
>>
>> RewriteRule . /index.php
>>
>> For "data and name" or "numeric" or "custom"!
>> I didn't know you could do that in Apache/PHP.
>>
>> Any pointers to this technique and an explanation how it works?
> 
> The rewrite rule you mention matches anything that is not emptystring
> and forwards it to WordPress' index.php.
> 
> Rules prior to that one cause that rule to execute only if the file or
> directory that is requested doesn't physically exist.  So if you have a
> file called "kumquat.php" in your web root and someone makes a request
> for it, then they receive it.  But if someone makes a request for
> kumquat.php and the file isn't present, then the request is redirected
> toward WordPress' index.php.
> 
> From there, the WP_Rewrite class takes over.  This class is located in
> /wp-includes/classes.php
> 
> As I said in the most recent #meetup, I'm convinced that the only reason
> that the WP_Rewrite class works is because Ryan sacrifices small animals
> daily on its behalf.  The loa then possess him and use his fingers to
> type.  Just when I figure out what this class is doing, my brain spasms
> and I must imbibe enough alcohol to forget what I know.
> 
> My advice is to forget what you have seen here, and mention it to no
> one.  I'm likely to be hit by a bus on my way home tomorrow for
> revealing even this much to you.
> 
> I'm kidding, of course.  Explore away!
> 
> Owen
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 


More information about the wp-hackers mailing list