我需要帮助我正在重写从lighthttpd到apache httpd的规则。虽然我之前从未使用过lighthttpd。我希望有人可以帮我改写这段代码。我甚至在apache中对Rule系统感到厌烦,但并没有那么糟糕。
"^install/?$" => "install.php",
"^/doc/([a-z]+)/?$" => "doc.php?cat=$1",
"^/~([a-z.]+)/doc/([a-z]+)/?$" => "doc.php?project=$1&cat=$2",
"^/~([a-z.]+)/?$" => "index.php?project=$1",
"^/~([a-z.]+)/api/([a-z]+)/?$" => "index.php?project=$1&mode=$2",
"^/all/?$" => "list.php",
"^/api/([a-z]+)/all/?$" => "list.php?mode=$1",
"^/~([a-z.]+)/all/?$" => "list.php?project=$1",
"^/~([a-z.]+)/api/([a-z]+)/all/?$" => "list.php?project=$1&mode=$2",
"^/rss/?$" => "list.php?rss=1",
"^/~([a-z.]+)/rss/?$" => "list.php?project=$1&rss=1",
"^/all/([0-9]+)/?$" => "list.php?page=$1",
"^/api/([a-z]+)/all/([0-9]+)/?$" => "list.php?mode=$1&page=$2",
"^/~([a-z.]+)/all/([0-9]+)/?$" => "list.php?project=$1&page=$2",
"^/~([a-z.]+)/api/([a-z]+)/all/([0-9]+)/?$" => "list.php?project=$1&mode=$2&page=$3",
"^/([0-9]+)/?$" => "show.php?id=$1",
"^/~([a-z.]+)/([0-9]+)/?$" => "show.php?project=$1&id=$2",
"^/([0-9]+)/([a-z|A-Z]+)/?$" => "show.php?id=$1&mode=$2",
"^/~([a-z.]+)/([0-9]+)/([a-z|A-Z]+)/?$" => "show.php?project=$1&id=$2&mode=$3",
"^/api/([a-z|A-Z]+)/([0-9]+)/?$" => "show.php?mode=$1&id=$2",
"^/~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/?$" => "show.php?project=$1&mode=$2&id=$3",
"^/([0-9]+)/([0-9]+)/?$" => "show.php?id=$1&hash=$2",
"^/~([a-z.]+)/([0-9]+)/([0-9]+)/?$" => "show.php?project=$1&id=$2&hash=$3",
"^/([0-9]+)/([0-9]+)/([a-z|A-Z]+)/?$" =/> "show.php?id=$1&hash=$2&mode=$3",
"^/~([a-z.]+)/([0-9]+)/([0-9]+)/([a-z|A-Z]+)/?$" => "show.php?project=$1&id=$2&hash=$3&mode=$4",
"^/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/?$" => "show.php?mode=$1&id=$2&hash=$3",
"^/~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/?$" => "show.php?project=$1&mode=$2&id=$3&hash=$4",
"^/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/(.*)$" => "show.php?mode=$1&id=$2&hash=$3&password=$4",
"^/~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/(.*)$" => "show.php?project=$1&mode=$2&id=$3&hash=$4&password=$5"
我唯一转换的就是第一行
RewriteRule ^install/.* install.php
答案 0 :(得分:0)
所以
"^install/?$" => "install.php"
变成
RewriteRule ^install/?$ install.php [L]
和
"^/doc/([a-z]+)/?$" => "doc.php?cat=$1"
变成
RewriteRule ^doc/([a-z]+)/?$ doc.php?cat=$1 [L]
和
"^/~([a-z.]+)/doc/([a-z]+)/?$" => "doc.php?project=$1&cat=$2",
变成
RewriteRule ^~([a-z.]+)/doc/([a-z]+)/?$ doc.php?project=$1&cat=$2 [L]
和
"^/~([a-z.]+)/?$" => "index.php?project=$1",
变成
RewriteRule ^~([a-z.]+)/?$ index.php?project=$1 [L]
等。