1、编写rewrite脚本,编辑/etc/lighttpd/local.lighttpd.conf内容如下:
url.rewrite-once = (
"^/forum/archiver/((fid|tid)-[\w\-]+\.html)$" => "forum/archiver/index.php?$1",
"^/forum/forum-([0-9]+)-([0-9]+)\.html$" => "forum/forumdisplay.php?fid=$1&page=$2",
"^/forum/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$" => "forum/viewthread.php?tid=$1&extra=page%%53D$3&page=$2",
"^/forum/space-(username|uid)-(.+)\.html$" => "forum/space.php?$1=$2",
"^/forum/tag-(.+)\.html$" => "forum/tag.php?name=$1"
)
这里假设论坛装在forum目录下,如果是装在根目录下则是:
url.rewrite-once = (
"^/archiver/((fid|tid)-[\w\-]+\.html)$" => "archiver/index.php?$1",
"^/forum-([0-9]+)-([0-9]+)\.html$" => "forumdisplay.php?fid=$1&page=$2",
"^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$" => "viewthread.php?tid=$1&extra=page%%53D$3&page=$2",
"^/space-(username|uid)-(.+)\.html$" => "space.php?$1=$2",
"^/tag-(.+)\.html$" => "tag.php?name=$1"
)
2、重启lighttpd,重启方法:/etc/init.d/lighttpd restart