Web 服务器:lighttpd,无法静态怎么办?急急急...

2016-07-07 15:39 来源:www.chinab4c.com 作者:ecshop专家

晓天,快来帮我解决

回答:
没人帮?

您可以参考docs里面的URLRewrite.txt,我们提供了apache和IIS的重写规则,你可以安装这个改成lighttpd的。

我要是会写我还来这里问吗?就是求官方出一个这样的文件呀,难道就只允许apache和IIS使用吗?对你们来说写一个这样的文件不用两分钟吧?

我没用过lighttpd的服务器,现写了一个重写规则,你可以试一下能不能用。打开lighttpd.conf文件,首先找到 #”mod_rewrite”,然后把前面的#号掉,表示启动这个插件,接着查找url.rewrite,或查找#### url handling modules (rewrite, redirect, access),也可以,找到后在下面加入以下代码。
  1. url.rewrite = (
  2. "^index\.html$" => "index\.php"
  3. "^category$" => "index\.php"
  4. "^feed-c([0-9]+)\.xml$" => "feed\.php\?cat=$1"
  5. "^feed-b([0-9]+)\.xml$" => "feed\.php\?brand=$1"
  6. "^feed-type([^-]+)\.xml$" => "feed\.php\?type=$1"
  7. "^feed\.xml$" => "feed\.php"
  8. "^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" => "category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8"
  9. "^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" => "category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5"
  10. "^category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" => "category\.php\?id=$1&brand=$2&page=$3&sort=$4&order=$5"
  11. "^category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" => "category\.php\?id=$1&brand=$2&page=$3"
  12. "^category-([0-9]+)-b([0-9]+)(.*)\.html$" => "category\.php\?id=$1&brand=$2"
  13. "^category-([0-9]+)(.*)\.html$" => "category\.php\?id=$1"
  14. "^goods-([0-9]+)(.*)\.html$" => "goods\.php\?id=$1"
  15. "^article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" => "article_cat\.php\?id=$1&page=$2&sort=$3&order=$4"
  16. "^article_cat-([0-9]+)-([0-9]+)(.*)\.html$" => "article_cat\.php\?id=$1&page=$2"
  17. "^article_cat-([0-9]+)(.*)\.html$" => "article_cat\.php\?id=$1"
  18. "^article-([0-9]+)(.*)\.html$" => "article\.php\?id=$1"
  19. "^brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html$" => "brand\.php\?id=$1&cat=$2&page=$3&sort=$4&order=$5"
  20. "^brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html$" => "brand\.php\?id=$1&cat=$2&page=$3"
  21. "^brand-([0-9]+)-c([0-9]+)(.*)\.html$" => "brand\.php\?id=$1&cat=$2"
  22. "^brand-([0-9]+)(.*)\.html$" => "brand\.php\?id=$1"
  23. "^tag-(.*)\.html$" => "search\.php\?keywords=$1"
  24. "^snatch-([0-9]+)\.html$" => "snatch\.php\?id=$1"
  25. "^group_buy-([0-9]+)\.html$" => "group_buy\.php\?act=view&id=$1"
  26. "^auction-([0-9]+)\.html$" => "auction\.php\?act=view&id=$1"
  27. "^exchange-id([0-9]+)(.*)\.html$" => "exchange\.php\?id=$1&act=view"
  28. "^exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" => "exchange\.php\?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6"
  29. "^exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" => "exchange\.php\?cat_id=$1&page=$2&sort=$3&order=$4"
  30. "^exchange-([0-9]+)-([0-9]+)(.*)\.html$" => "exchange\.php\?cat_id=$1&page=$2"
  31. "^exchange-([0-9]+)(.*)\.html$" => "exchange\.php\?cat_id=$1"
  32. )
复制代码