2012-03-08 119 views
1

如何將這個apache重寫規則轉換爲lighttpd重寫規則?Apache重寫規則到lighttpd

# 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

嘗試

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

} 

希望有所幫助。