如何轉換 RewriteCond 規則以便它們在 Lighttpd 中工作?

如何轉換 RewriteCond 規則以便它們在 Lighttpd 中工作?

如何轉換此 Apache 重寫規則以便它們在 Lighttpd 上運作?這實際上是一個 .htaccess 文件,我需要將它們放入lighttpd.conf 檔案中。

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule www.(.*) web.php?url=$1
RewriteRule sitemap/(.*) mapdi.php?page=$1
RewriteRule tags_(.*)\.html$ tags.php?keywords=$1
RewriteRule ^([^-]*)-page-([^-]*)\.html$ tags.php?keywords=$1&page=$2 [L]
RewriteRule ^sitemap_([^-]*)\.html$ sitemap_web.php?page=$1 [L]
RewriteRule ^sitemap\.html$ sitemap.php$1 [L]
RewriteRule ^privacy\.html$ privacy.php$1 [L]

我轉換了部分程式碼,但不確定如何轉換:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$

.....

這是我可以轉換的:

url.rewrite-once = (

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$

    "www.(.*)" => "web.php?url=$1",
    "sitemap/(.*)" => "mapdi.php?page=$1",
    "tags_(.*)\.html$" => "tags.php?keywords=$1",
    "^([^-]*)-page-([^-]*)\.html$" => "tags.php?keywords=$1&page=$2",
    "^sitemap_([^-]*)\.html$" => "sitemap_web.php?page=$1",
    "^sitemap\.html$" => "sitemap.php$1",
    "^privacy\.html$" => "privacy.php$1"
)

相關內容