[wp-hackers] needs testing and feedback: small patch
for nicepermalinks on lighttpd
Ryan Boren
ryan at boren.nu
Wed Mar 16 16:53:12 GMT 2005
On Wed, 2005-03-16 at 09:29 -0500, Mark Jaquith wrote:
> Mark R. Andrachek, Jr. wrote:
>
> >I tried out the suggested patch, as I am not in favor of the 404
> >method (I also use gallery2 with permalinks, and would like those to
> >be able to work as well -- next on my list).
> >
> >The changes seem to work fine for me (webmages.com), I also added
> >rewrite rules for:
> >
> >url.rewrite = ( "^/page/(.+)$" => "/index.php/page/$1" )
> >url.rewrite = ( "^/comments/(.+)$" => "/index.php/comments/$1" )
> >url.rewrite = ( "^/search/(.+)$" => "/index.php/search/$1" )
> >url.rewrite = ( "^/feed/(.+)$" => "/index.php/feed/$1" )
> >
>
> I'm not familiar with this style of rewrite, but it seems to me that you
> could do this and consolidate it into one:
>
> url.rewrite = ( "^/(page|comments|search|feed)/(.+)$" =>
> "/index.php/$1/$2" )
Or,
url.rewrite = ( "^/(page|comments|search|feed)/" =>
"/index.php?error=404" )
error=404 simply tells WP to parse REQUEST_URI as a permalink. The
rewrite regex limits what gets processed in this way.
And then there's the match everything and let WP sort it out rule, which
is similar to using a 404 handler.
url.rewrite = ( "." => "/index.php?error=404" )
This assumes lighttpd offers rewrite conditionals that can be used to
prevent rewriting files and directories that actually exist in the
filesystem.
To assist with the first approach, WP_Rewrite has search_base,
author_base, feed_base, category_base, etc. variables. There's also the
list of page uris in the options DB. These can be used to automatically
generate a list of base-anchored rewrite rules.
Ryan
More information about the wp-hackers
mailing list