Daily Archive for Septiembre 28th, 2007

lighttpd and WordPress MU (revisited)

  • english
  • spanish

On my previous article about lighttpd and WordPress MU I proposed a LUA script to be used via mod_magnet to handle URL rewrites, as an alternative to the Apache .htaccess file. It worked, but many people complained that using LUA for every page request was quite a load penalty for the server, which I don’t fully agree as it should be sufficiently optimized. But anyway, I’d rather use a solution based off config parameters like url.rewrite, too.

Some people suggested this other method which only used server.error-handler-404. The problem is that it’s designed for standard WordPress, and doesn’t handle WPMU directory-based blogs well. But it set me on the right track anyway. :)

By using both url.rewrite and error-handler-404, you can redirect directory-blogs to the base files and all the rest to the index.php file. Anyway this method still has one big problem: all the queries redirected to index.php by the error-handler-404 will lose all the querystring variables, rendering plugins that use them (like jLanguage which uses ?lan=XXXXXX) useless. Other than that, this method seems to work.

I’m string trying to improve this configuration by using the $PHYSICAL["existing-path"] variable in lighttpd 1.5.0, but still got nothing. In the meantime, the configuration with the querystring problem would be like this:

url.rewrite-once = (
“^/(.*/)?files/$” => “/index.php”,
“^/(.*/)?files/(.*)” => “/wp-content/blogs.php?file=$2″,
“^(/wp-admin/.*)” => “$1″,
“^/([_0-9a-zA-Z-]+/)?(wp-.*)” => “/$2″,
“^/([_0-9a-zA-Z-]+/)?(.*\.php)$” => “/$2″,
)
server.error-handler-404  = “/index.php”
Enviar a:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BarraPunto
  • Meneame
  • Slashdot
  • Technorati
  • YahooMyWeb



Creative Commons Attribution-NonCommercial 2.5 Spain
Creative Commons Attribution-NonCommercial 2.5 Spain