Solution to WordPress Permalink for lighttpd

3 Comments

As you know, I have switched from Apache to lighttpd and I had an issue with WordPress Permalink. It is unbelieveable that with the a single line of code below to be added into the /etc/lighttpd/lighttpd.conf configuration file this give me a simplest solution to WordPress Permalink for lighttpd: -

server.error-handler-404 = "/index.php"

However, you can also use the long way of lighttpd rewrite rules below to achieve the same solution above.

1. Create a file at /etc/lighttpd/wp-rewrite.conf with the following contents: -

url.rewrite-once = (
"^" + wpdir + "(wp-.+).*/?" => "$0",
"^" + wpdir + "(sitemap.xml)" => "$0",
"^" + wpdir + "(xmlrpc.php)" => "$0",
"^" + wpdir + "keyword/([A-Za-z_0-9-])/?$" => wpdir + "index.php?keyword=$1",
"^" + wpdir + "(.+)/?$" => wpdir + "index.php/$1"
)

2. Include the following contents into your virtual hosting: -

var.wpdir = "/"
include "wp-rewrite.conf"

3. Lastly, make sure that mod_rewrite module is loaded or un-comment in /etc/lighttpd/lighttpd.conf configuration file.

Source: Ubuntu Tutorials | literal thoughts

3 Comments (+add yours?)

  1. Rose Brown
    Mar 04, 2009 @ 02:02:56

    I want to change my wordpress blog permalink structure to %postname% instead of the default ?p=25 but I don’t want to harm my feedburner feed, trackbacks, links, and google index. I have read that I could use Permalink Redirect plugin to do this, but will it hurt my blog? My blog is “young” so I only have about 50 post. I just don’t want to do any harm, but I also want to have a more SEO friendly permalink structure.

  2. Invisible121
    May 12, 2009 @ 16:52:51

    You said:
    “Include the following contents into your virtual hosting:”

    Where do I need to include it? Thanks

  3. wingloon
    May 14, 2009 @ 01:15:11

    Invisible121, below is the sample: -

    $HTTP["host"] =~ “^(www.domain.com|domain.com)” {
    server.document-root = “/srv/www/lighttpd/domain.com”
    var.wpdir = “/”
    include “wp-rewrite.conf”
    }

Leave a Reply