阿帕奇重写规则的lighttpd [英] Apache rewrite rule to lighttpd

查看:198
本文介绍了阿帕奇重写规则的lighttpd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何此Apache重写规则转换为lighttpd的重写规则?

 的URL#打开重写
RewriteEngine叙述在#安装目录
的RewriteBase / adpanel /#被视为保护隐藏文件
<文件*>
 为了拒绝,允许
 拒绝从所有
< /文件>#被视为保护应用程序和系统文件
重写规则^(?:应用|模块|系统)。\\ B *的index.php / $ 0 L]#允许存在直接显示的任何文件或目录
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d#重写所有其他URL的index.php / URL
重写规则。*的index.php / $ 0 PT]


解决方案

尝试

  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.

这篇关于阿帕奇重写规则的lighttpd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆