我需要帮助,我正在将规则从 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