WordPress on Lighty (lighttpd) with cool uri

If you wants to run WordPress site on Lighty (lighttpd) instead of Apache, you will find out that there is one little problem. Ligthy does not support .htaccess for mod_rewrite, so you will have to configure rewriting some other way. And it’s really simple, the only thing you really have to do is add this lines to your config file (/etc/lighttpd/lighttpd.conf):

        url.rewrite = (
                "^/(.*)\.(.+)$" => "$0",
                "^/(.+)/?$" => "/index.php/$1"
        )

And check if you have mod_rewrite enabled in the same config file:

server.modules = (
        "mod_access",
        "mod_accesslog",
        "mod_fastcgi",
        ... ,
        "mod_rewrite",
)

The complete record for this blog in lighttpd.conf is:

# this is the settings for blog subdomain running wordpress
$HTTP["host"] =~ "(blog\.)vyvazil\.eu$" {
        # these three lines below should be pointing at real paths 
        server.document-root = "/home/domains/vyvazil.eu/web/subdomains/blog/" 
        server.errorlog = "/home/domains/vyvazil.eu/web/log/error.log"
        accesslog.filename = "/home/domains/vyvazil.eu/web/log/access.log"

        url.rewrite = (
                "^/(.*)\.(.+)$" => "$0",
                "^/(.+)/?$" => "/index.php/$1"
        )
}

┬áDon’t forget to restart your web server after saving changes in configuration file.

One thought on “WordPress on Lighty (lighttpd) with cool uri”

Leave a Reply

Your email address will not be published. Required fields are marked *