如何转换RewriteCond规则,以便它们在Lighttpd中工作?

时间:2013-12-22 09:58:01

标签: regex .htaccess mod-rewrite url-rewriting 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"
)

0 个答案:

没有答案