lighttpd 1.4 + php 5.4 + drupal clean urls

Here’s what I’m using for drupal powered by lighttpd 1.4 & php-fpm 5.4 :

        ### shorten /files, /themes
        ### 2012-01-30 - randall
        ### %0 = entire hostname
        ### %1 = prefix of *.*.example.com
        url.rewrite-once = ( "^/files/(.*)$" => "/sites/%0/files/$1")
                             ###"^/themes/(.*)$" => "/sites/%0/themes/$1")

        ### Deny access to backup_migrate module dumps
        $HTTP["url"] =~ "^(\/sites\/(.*)\/files\/backup_migrate\/)" {
            url.access-deny = ("")
        }

        ### clean urls for >= lighttpd 1.4.24
        ### http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModRewrite#urlrewrite-repeat-if-not-file
        ### 2012-01-05 - randall - fix for drupal 7 with image cache
        url.rewrite-if-not-file = (
            "^\/([^\?]*)\?(.*)$" => "/index.php?q=$1&$2",
            "^\/(.*)$" => "/index.php?q=$1"
        )

        ### "Fix" for Drupal SA-2006-006 (but let imagecache work)
        ### http://www.linode.com/forums/viewtopic.php?t=5300%3E
        $HTTP["url"] =~ "^(\/sites\/(.*)\/files\/)" {
            $HTTP["url"] !~ "^(\/sites\/(.*)\/files\/imagecache\/)" {
                fastcgi.server = ()
            }
        }

 

 

end of snippet.

3 Responses to “lighttpd 1.4 + php 5.4 + drupal clean urls”

  1. Alta says:

    Finally a post!

  2. Alta says:

    I I wish you were a freelance WordPress developer.

  3. Sil68 says:

    Great job! 🙂

    Looking into the first comment block there it is stated “%0” and “%1”, but in the actual code it is “%0” and “$1”; is this correct?

    If my drupal directory would be different from the document root (eg. http://my.host.net), and accessed by means of an alias (eg. http://my.host.net/drupal), how would the configuration has to get amended?

Leave a Reply

*
Powered by WordPress | Designed by Elegant Themes