Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 如何创建重定向规则?_Regex_Lighttpd - Fatal编程技术网

Regex 如何创建重定向规则?

Regex 如何创建重定向规则?,regex,lighttpd,Regex,Lighttpd,如何在lighttpd中创建重定向此类型的所有URL的规则:http:///dr至端口443。以及其他所有未以.png结尾的端口5480 以下脚本的工作方式相当有趣: http:///dr被重定向到5480 http:////dr被重定向到443/dr http:///png被重定向到443/dr http:///qwerty被重定向到5480 http:///qwerty.png未被重定向 $SERVER["socket"] == ":80" { server.use-ipv6 = "

如何在lighttpd中创建重定向此类型的所有URL的规则:
http:///dr
至端口443。以及其他所有未以
.png
结尾的端口5480

以下脚本的工作方式相当有趣:

http:///dr
被重定向到
5480

http:////dr
被重定向到
443/dr

http:///png
被重定向到
443/dr

http:///qwerty
被重定向到
5480

http:///qwerty.png
未被重定向

$SERVER["socket"] == ":80" {
    server.use-ipv6 = "enable"
    server.document-root = "..."
    $HTTP["host"] =~ "^(.+)$" {
        url.redirect = ( ".\*dr$" => "https://%1:443/dr",
                         "(?<!\.png)$" => "https://%1:5480/" )
    }
}
$SERVER[“socket”]=“80”{
server.use-ipv6=“启用”
server.document-root=“…”
$HTTP[“主机”]=~“^(+)$”{
url.redirect=(“\*dr$”=>“https://%1:443/dr”,

(?原来正则表达式很好,但是浏览器缓存绊倒了我们。一切都在匿名窗口中工作