[转]prestashop 1.4.4的lighttpd rewrite规则

By | 2011/12/01

lighttpd的高效率成为很多小型的VPS下运行的网页服务,特别是免费的面板Kloxo就可以使用lighttpd. 但prestashop的重写规则都是针对apache的,所以要记录一下prestashop 1.4.4的lighttpd rewrite重写规则。

由于prestashop 1.4.3更新了一个新的“文件系统”,将图片文件分文件夹存放,为了同时兼容两种的文件存放方式,需要更改重写规则。

url.rewrite-once = (
“^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$” => “/img/p/$1-$2$3.jpg”,
“^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1-$2.jpg”,
“^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$1$2.jpg”,
“^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$2/$1$2$3.jpg”,
“^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$2/$3/$1$2$3$4.jpg”,
“^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg”,
“^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg”,
“^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg”,
“^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg”,
“^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$” => “/img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg”,

“^/([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$” => “/img/c/$1$2.jpg”,
“^/lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” => “/product.php?id_product=$3&isolang;=$1$6”,
“^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” => “/product.php?id_product=$2&isolang;=$1&$4”,

“^/lang-([a-z]{2})/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” => “/cms.php?id_cms_category=$2&isolang;=$1&$5”,

“^/lang-([a-z]{2})/content/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” => “/cms.php?id_cms=$2&isolang;=$1&$4”,
“^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” => “/product.php?id_product=$2&$5”,
“^/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” => “/product.php?id_product=$1&$4”,
“^/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” => “/category.php?id_category=$1&$4”,
“^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” => “/category.php?id_category=$2&isolang;=$1&$5”,

“^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” => “/cms.php?id_cms_category=$1”,

“^/content/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” => “/cms.php?id_cms=$1&$4”,
“^/([0-9]+)__([a-zA-Z0-9-]*)(\?(.*))?” => “/supplier.php?id_supplier=$1&$4”,
“^/([0-9]+)_([a-zA-Z0-9-]*)(\?(.*))?” => “/manufacturer.php?id_manufacturer=$1&$4”,
“^/lang-([a-z]{2})/(\?(.*))?” => “/index.php?isolang=$1&$2”,
“^/address(\?(.*))?” => “/address.php$1”,
“^/addresses(\?(.*))?” => “/addresses.php$1”,
“^/authentication(\?(.*))?” => “/authentication.php$1”,
“^/cart(\.php)?(\?(.*))?” => “/cart.php$2”,
“^/discount(\?(.*))?” => “/discount.php$1”,
“^/guest-tracking(\?(.*))?” => “/guest-tracking.php$1”,
“^/order-history(\?(.*))?” => “/history.php$1”,
“^/identity(\?(.*))?” => “/identity.php$1”,
“^/my-account(\?(.*))?” => “/my-account.php$1”,
“^/order(\?(.*))?” => “/order.php$1”,
“^/order-follow(\?(.*))?” => “/order-follow.php$1”,
“^/quick-order(\?(.*))?” => “/order-opc.php$1”,
“^/password-recovery(\?(.*))?” => “/password.php$1”,
“^/order-slip(\?(.*))?” => “/order-slip.php$1”,
“^/search(\?(.*))?” => “/search.php$1”,
“^/contact-us(\?(.*))?” => “/contact-form.php$1”,
“^/new-products(\?(.*))?” => “/new-products.php$1”,
“^/page-not-found(\?(.*))?” => “/404.php$1”,
“^/sitemap$” => “/sitemap.php$1”,
“^/best-sales(\?(.*))?” => “/best-sales.php$1”,
“^/prices-drop(\?(.*))?” => “/prices-drop.php$1”,
“^/stores(\?(.*))?” => “/stores.php$1”,
)

原文:http://www.znjack.com/prestashop-1-4-4%E7%9A%84lighttpd-rewrite%E8%A7%84%E5%88%99.html,334

3 thoughts on “[转]prestashop 1.4.4的lighttpd rewrite规则

  1. dengor Post author

    url.rewrite-once = (
    “^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$” => “/img/p/$1-$2$3.jpg”,
    “^/([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$” => “/img/c/$1$2.jpg”,
    “^/lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” => “/product.php?id_product=$3&isolang;=$1$6” ,
    “^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” =>”/product.php?id_product=$2&isolang;=$1&$4″,
    “^/lang-([a-z]{2})/content/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” =>”/cms.php?id_cms=$2&isolang;=$1&$4″,

    “^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” => “/product.php?id_product=$2&$5” ,
    “^/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?” =>”/product.php?id_product=$1&$4″,

    “^/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” =>”/category.php?id_category=$1&$4″ ,
    “^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” =>”/category.php?id_category=$2&isolang;=$1&$5″ ,
    “^/content/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?” =>”/cms.php?id_cms=$1&$4″ ,
    “^/([0-9]+)__([a-zA-Z0-9-]*)(\?(.*))?” =>”/supplier.php?id_supplier=$1&$4″ ,
    “^/([0-9]+)_([a-zA-Z0-9-]*)(\?(.*))?” =>”/manufacturer.php?id_manufacturer=$1&$4″,

    “^/lang-([a-z]{2})/(\?(.*))?” => “/index.php?isolang=$1&$2”,

    “^/address(\?(.*))?” => “/address.php$1”,
    “^/addresses(\?(.*))?” => “/addresses.php$1”,
    “^/authentication(\?(.*))?” => “/authentication.php$1”,
    “^/cart(\?(.*))?” => “/cart.php$1”,
    “^/discount(\?(.*))?” => “/discount.php$1”,
    “^/guest-tracking(\?(.*))?” => “/guest-tracking.php$1”,
    “^/order-history(\?(.*))?” => “/order-history.php$1”,
    “^/identity(\?(.*))?” => “/identity.php$1”,
    “^/my-account(\?(.*))?” => “/my-account.php$1”,
    “^/order(\?(.*))?” => “/order.php$1”,
    “^/order-follow(\?(.*))?” => “/order-follow.php$1”,
    “^/quick-order(\?(.*))?” => “/order-opc.php$1”,
    “^/password-recovery(\?(.*))?” => “/password.php$1”,
    “^/order-slip(\?(.*))?” => “/order-slip.php$1”,
    “^/search(\?(.*))?” => “/search.php$1”,
    “^/contact-us(\?(.*))?” => “/contact-form.php$1”,
    “^/new-products(\?(.*))?” => “/new-products.php$1”,
    “^/page-not-found(\?(.*))?” => “/404.php$1”,
    “^/sitemap$” => “/sitemap.php$1”,
    “^/best-sales(\?(.*))?” => “/best-sales.php$1”,
    “^/prices-drop(\?(.*))?” => “/prices-drop.php$1”,
    “^/stores(\?(.*))?” => “/stores.php$1”

    )

  2. dengor Post author

    注意其中的双引号和后台”,之间没有空格

Comments are closed.