Nginx环境下常见的开源项目重写汇总
我们做PHP开发的,作者寒冰我觉得大部分时候都在跟开源的系统打交道。比如:Discuz、PHPCMS、ecshop、wordpress等开源系统。一般我们都是在本地搭建测试环境,用的web服务器都是apache。这时候假如服务器换成了nginx。我们得重新写重写文件,好麻烦。
鉴于此需求点,今天寒冰我特意整理了这些开源的重写文件。希望能帮到大家。
1、PHPCMS v9重写。
rewrite ^/show-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3;
rewrite ^/content-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3;
rewrite ^/list-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=lists&catid=$1&page=$2;
rewrite ^/tag-([^\.]*)-([0-9]+)-([0-9]+).html /index.php?m=content&c=tag&catid=$2&tag=$1&page=$3;
rewrite ^/comment-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=comment&c=index&a=init&commentid=content_$1-$2-$3;
2、discuz 7.2重写:
rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;
3、discuz x2系列重写:
rewrite ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^(.*)/article-([0-9]+)\.html$ $1/portal.php?mod=article&articleid=$2 last;
rewrite ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^(.*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
4、ecshop重写:
rewrite ^/index\.html /index.php last;
rewrite ^/category$ /index.php last;
rewrite ^/feed-c([0-9]+)\.xml$ /feed.php?cat=$1 last;
rewrite ^/feed-b([0-9]+)\.xml$ /feed.php?brand=$1 last;
rewrite ^/feed\.xml$ /feed.php last;
rewrite ^/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 last;
rewrite ^/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 last;
rewrite ^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
rewrite ^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ /category.php?id=$1&brand=$2&page=$3 last;
rewrite ^/category-([0-9]+)-b([0-9]+)(.*)\.html$ /category.php?id=$1&brand=$2 last;
rewrite ^/category-([0-9]+)(.*)\.html$ /category.php?id=$1 last;
rewrite ^/goods-([0-9]+)(.*)\.html /goods.php?id=$1 last;
rewrite ^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
rewrite ^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$ /article_cat.php?id=$1&page=$2 last;
rewrite ^/article_cat-([0-9]+)(.*)\.html$ /article_cat.php?id=$1 last;
rewrite ^/article-([0-9]+)(.*)\.html$ /article.php?id=$1 last;
rewrite ^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
rewrite ^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html /brand.php?id=$1&cat=$2&page=$3 last;
rewrite ^/brand-([0-9]+)-c([0-9]+)(.*)\.html /brand.php?id=$1&cat=$2 last;
rewrite ^/brand-([0-9]+)(.*)\.html /brand.php?id=$1 last;
rewrite ^/tag-(.*)\.html /search.php?keywords=$1 last;
rewrite ^/snatch-([0-9]+)\.html$ /snatch.php?id=$1 last;
rewrite ^/group_buy-([0-9]+)\.html$ /group_buy.php?act=view&id=$1 last;
rewrite ^/auction-([0-9]+)\.html$ /auction.php?act=view&id=$1 last;
rewrite ^/exchange-id([0-9]+)(.*)\.html$ /exchange.php?id=$1&act=view last;
rewrite ^/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 last;
rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
rewrite ^/exchange-([0-9]+)-([0-9]+)(.*)\.html$ /exchange.php?cat_id=$1&page=$2 last;
rewrite ^/exchange-([0-9]+)(.*)\.html$ /exchange.php?cat_id=$1 last;
5、phpwind重写:
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
rewrite ^(.*)/data/(.*)\.(htm|php)$ 404.html last;
rewrite ^(.*)/attachment/(.*)\.(htm|php)$ 404.html last;
rewrite ^(.*)/html/(.*)\.(htm|php)$ 404.html last;
6、shopex重写:
rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
7、wordpress重写:
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
8、typecho 重写:
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
原文:http://www.phpcxz.com/archives/nginx_vhosts_rewrite.html
Nginx环境下常见的开源项目重写汇总的更多相关文章
- nginx环境下配置nagios-关于nagios配置文件nginx.conf
接上文:nginx环境下配置nagios-关于nginx.conf 配置如下: ; location ~ .*\.(php|php5)?$ { ...
- nginx环境下配置nagiosQL-关于nagiosql配置文件
接上文:nginx环境下配置nagios-关于nginx.conf nagiosql文件应该处于conf/domain/目录下 nagiosql配置如下: ; gzi ...
- Nginx环境下配置PHP使用的SSL认证(https)
最近一段时间发现好多网站都从http协议变成了加密的https协议,比如说百度.吾志等等.https看起来比http高端了好多,而且在不同的浏览器向上还会显示出不同于http的URL展示效果(比如说c ...
- 【thinkphp 5 在nginx 环境下路由无法生效(404 500错误 )的解决方法】
非常惭愧的说,由于之前一直使用的是windowservice,安装apache来进行服务器布置的,这种方式也是最简单最直接的方式, 但是由于php的服务大多都是linux栈的,咱们也不能落后呀,在 ...
- 【简书】在阿里云自带的CentOS + LAMP环境下部署一个Laravel项目
在阿里云自带的CentOS + LAMP环境下部署一个Laravel项目 作者 DonnieZero 关注 2017.07.29 22:02* 字数 2218 阅读 5556评论 3喜欢 1赞赏 1 ...
- nginx环境下启动php-fpm
nginx环境下启动php-fpm 1.首先查看是否安装了php-fpm 这个我试了好多命令都不行比如 rpm -qa php-fpm , rpm -ql php-fpm , which php-fp ...
- CI在nginx环境下去掉url中的index.php
在nginx环境下CI框架默认URL规则访问不了,出现500错误,如: http://blog.php230.com/index.php/keywords 今天在服务器配置CI框架环境时,去除URL中 ...
- Nginx环境下设置zblog伪静态方法
Apache的环境非常简单.可以点击创建 .htaccess就可以了 Nginx环境下设置伪静态,并没有那个一键创建的按钮.只看到了这样的一个提示. 别的环境未测试.宝塔面板中 反正我是没找到. 宝塔 ...
- Nginx环境下,PHP下载,中文文件,下载失效(英文可以下载)怎么解决呢?
参考出处: http://www.imooc.com/qadetail/76393 Nginx环境下,PHP下载,中文文件,下载失效(英文可以下载)怎么解决呢? 背景介绍: 文件名 为英文时可以下载 ...
随机推荐
- Python自动化运维之12、面向对象进阶
上一篇<面向对象基础>文章介绍了面向对象基本知识: 面向对象是一种编程方式,此编程方式的实现是基于对 类 和 对象 的使用 类 是一个模板,模板中包装了多个“函数”供使用(可以讲多函数中公 ...
- SCJP_104——题目分析(2)
3. public class IfTest{ public static void main(String args[]){ int x=3; int y=1; if(x=y) System.out ...
- 转:Zend_Cache的使用
一.Zend_Cache快速浏览 Zend_Cache 提供了一个缓存任何数据的一般方法. 在Zend Framework中缓存由前端操作,同时通过后端适配器(File, Sqlite, Memcac ...
- sphinx,github和readthedocs配合使用
http://daler.github.io/sphinxdoc-test/includeme.html http://pages.github.com/ http://www.lulinfeng.c ...
- android手机游戏开发Cocos2d-x开发分享
我想现在应该没有人没有玩过手机游戏了吧,当然所有人都玩过,但不是所有人都知道怎么去开发手机游戏,因为许多人都感觉做开发是一件很困难的事儿,身边的朋友也对此感觉难度很大.但是,现在我可以告诉你,手机游戏 ...
- 【jQuery】jQuery API 过 一 遍
closest, parents <!DOCTYPE html> <html> <head> <meta charset="utf-8"& ...
- 【转】HashMap和HashSet的区别
原文网址:http://www.importnew.com/6931.html HashMap和HashSet的区别是Java面试中最常被问到的问题.如果没有涉及到Collection框架以及多线程的 ...
- sql语句:union
sql语句中,join,left join中,是将两个或多个表横向连接,而有时,我们需要将几个表或1个表纵向连接,甚至是连接自身,就比如,某些数据库脚本特别不合理的时候,但我们又不能说啥 ....郁 ...
- 【转】Contrary to the answers here, you DON'T need to worry about encoding!
For those goals, I honestly do not understand why people keep telling you that you need the encoding ...
- WPF - EventSetter
WPF中添加Event 1. ListBox中添加Event <ListBox x:Name="itemsControl" BorderThickness="0&q ...