Apache-2.2

Lighttpd mod_rewrite 到 Apache mod_rewrite

  • April 1, 2013

我想把這個 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"
   )
}

感謝您的幫助!

您可能需要的不僅僅是在這裡重寫…

這樣的事情可能會做到這一點:

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>

引用自:https://serverfault.com/questions/494988