Lighttpd mod_rewrite 到 Apache mod_rewrite

Lighttpd mod_rewrite 到 Apache mod_rewrite

我想将这个 Lighttpd mod_rewrite 转换为 apache 重写代码。

$HTTP["host"] =~ "^(i\.ylar\.se|puush\.me)$" {
    server.document-root = "/var/www/servers/i.ylar.se/"
    url.rewrite-once = (
            "^/api/up" => "/upload.php",
            "^/([a-zA-Z0-9]+)$" => "/view.php?image=$1"
    )
}

谢谢你的帮助!

答案1

您可能需要的不仅仅是在这里重写......

类似这样的事情可能会做到这一点:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName   i.ylar.se
    ServerAlias  puush.me

    DocumentRoot /var/www/servers/i.ylar.se

    RewriteEngine On

    RewriteRule ^/api/up               /upload.php [L]
    RewriteRule ^/([a-zA-Z0-9]+)$     /view.php?image=$1

</VirtualHost>

相关内容