[rewrite]osCommerce 在 nginx 上的 rewrite 规则

2010年9月13日星期一 | | |

osCommerce 在 nginx 上的 rewrite 规则

-----------------------  Bof Code ------------------------
location / {
 if (!-e $request_filename)
 {
rewrite "^(.*)-p-(.*).html" /product_info.php?products_id=$2%1;
rewrite "^(.*)-p-(.*).html" /product_info.php?products_id=$2&% last;
rewrite "^(.*)-c-(.*).html" /index.php?cPath=$2&% last;
rewrite "^(.*)-m-(.*).html" /index.php?manufacturers_id=$2&% last;
rewrite "^(.*)-pi-(.*).html" /popup_image.php?pID=$2&% last;
rewrite "^(.*)-t-(.*).html" /articles.php?tPath=$2&% last;
rewrite "^(.*)-au-(.*).html" /articles.php?authors_id=$2&% last;
rewrite "^(.*)-a-(.*).html" /article_info.php?articles_id=$2&% last;
rewrite "^(.*)-pr-(.*).html" /product_reviews.php?products_id=$2&% last;
rewrite "^(.*)-pri-(.*).html" /product_reviews_info.php?products_id=$2&% last;
rewrite "^(.*)-i-(.*).html" /information.php?info_id=$2&% last;
rewrite "^(.*)-pm-([0-9]+).html" /info_pages.php?pages_id=$2&% last;
rewrite "^(.*)-links-(.*).html" /links.php?lPath=$2&% last;
rewrite "^(.*)-n-(.*).html" /newsdesk_info.php?newsdesk_id=$2&% last;
rewrite "^(.*)-nc-(.*).html" /newsdesk_index.php?newsPath=$2&% last;
rewrite "^(.*)-nri-(.*).html" /newsdesk_reviews_info.php?newsdesk_id=$2&% last;
rewrite "^(.*)-nra-(.*).html" /newsdesk_reviews_article.php?newsdesk_id=$2&% last;
rewrite "^(.*)-f-(.*).html" /faqdesk_info.php?faqdesk_id=$2&% last;
rewrite "^(.*)-fc-(.*).html" /faqdesk_index.php?faqPath=$2&% last;
rewrite "^(.*)-fri-(.*).html" /faqdesk_reviews_info.php?faqdesk_id=$2&% last;
rewrite "^(.*)-fra-(.*).html" /faqdesk_reviews_article.php?faqdesk_id=$2&% last;
 }
}

-----------------------  Eof Code ------------------------

相应的apache为:

-----------------------  Bof Code ------------------------
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2%1
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}

-----------------------  Eof Code ------------------------
参考:http://www.crazylemon.net/nginx/620.html

0 评论:


所有文章收集于网络,如果有牵扯到版权问题请与本站站长联系。谢谢合作![email protected]