[wp-hackers] rewrite technique
Owen Winkler
ringmaster at midnightcircus.com
Mon Oct 24 00:27:10 GMT 2005
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
More information about the wp-hackers
mailing list