将Apache重写规则转换为Lighttpd规则

3
如何将这个apache rewrite规则转换为lighttpd rewrite规则?
# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /adpanel/

# Protect hidden files from being viewed
<Files .*>
 Order Deny,Allow
 Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
1个回答

2

尝试

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

$HTTP["host"] == "example.com" {

    server.document-root = "/var/www/example.com/wwwroot/adpanel/"

    $HTTP["url"] =~ "^/application" {
            url.access-deny = ("")
    }

    $HTTP["url"] =~ "^/modules" {
            url.access-deny = ("")
    }

    $HTTP["url"] =~ "^/system" {
            url.access-deny = ("")
    }

    ## If later than lighttpd 1.4.24
    url.rewrite-if-not-file = (
        "^/(.*)$" => "/index.php/$1"
    )

    ## If older than 1.4.24 yo will have to reference actual files in the rewrite e.g.
    #url.rewrite = (
    #    "/(css|img|js|stats)/" => "$0",  ## $0 means the actual query string i.e don't rewrite.
    #    "^/(.*)$" => "/index.php/$1"
    #)

}

希望这能有所帮助。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接