且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

阿帕奇重写规则的lighttpd

更新时间:2023-09-18 23:32:40

尝试

  server.modules =(
    mod_access
    mod_rewrite的
)$ HTTP [主机] ==example.com{    server.document根=/var/www/example.com/wwwroot/adpanel/    $ HTTP [网址] =〜^ /应用程序{
            url.access-否认=()
    }    $ HTTP [网址] =〜^ /模块{
            url.access-否认=()
    }    $ HTTP [网址] =〜^ /系统{
            url.access-否认=()
    }    ##如果晚于lighttpd的1.4.24
    url.rewrite-IF-没有文件=(
        ^ /(。*)$=> /index.php/$1
    )    ##如果年龄大于1.4.24哟将在改写引用实际文件例如
    #url.rewrite =(
    #/(CSS | IMG | JS |统计)/=> $ 0,## $ 0表示实际的查询字符串即不重写。
    #^ /(。*)$=> /index.php/$1
    #)}

希望有所帮助。

How to convert this apache rewrite rule to lighttpd rewrite rule?

# 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]

Try

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"
    #)

}

Hope that helps.