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下载,中文文件,下载失效(英文可以下载)怎么解决呢? 背景介绍: 文件名 为英文时可以下载 ...
随机推荐
- 关于PHPstorm 使用技巧
慢慢更新,一点点积累,都是自己在使用中遇到的问题 设置:(2016.4.15) 1:注释模板,phpstorm 有非常强大的注释模板,可以根据自己的需求随时更改,并设置快捷键,非常方便 新文件注释 P ...
- mysql 表格中的数据量过大,修改数据库字段信息会花费很长的时间
遇到几百万的数据操作遇到很多问题,比如分区,比如分表,sql语句的效率问题.努力学习好mysql优化还是很有必要的.
- curl 解析
获得页面 使用命令:curl http://curl.haxx. se 这是最简单的使用方法.用这个命令获得了http://curl.haxx. se指向的页面,同样,如果这里的URL指向的是一个文件 ...
- IOS自定义alertview
在家闲来无事,于是就看起来ios绘图的那块,写点什么好呢? 鼓捣了一会,总算写出了一个小东西 这个是写完以后的效果 这里我实现了三种款式的alertview 分别是成功,错误和警告,剩下的呢有空继续添 ...
- 【问题】tableView的每组的头部不不能滚动的解决方案
group模式的解决方案 - (void)scrollViewDidScroll:(UIScrollView*)scrollView { if (scrollView == self.tableVie ...
- nginx+tomcat 配置虚拟目录。。
之前nginx作为代理.之前的location写的太绝对了..之前把动态请求全部交给tomcat,然后需要配置虚拟路径的时候,去到tomcat就被404了.得高人指点之后,配置虚拟目录的时候需要重新写 ...
- 『GitHub』Git常用命令记录
Commands: git init 把当前目录变成Git可以管理的仓库 随后出现.git目录,这个目录是Git来跟踪管理版本库的git commit -m "change message& ...
- 作了点有意义 的事,加入CLOUDSTACK官方文档的中文翻译工作
https://www.transifex.com/ 昨天到今天,作了个部署构架方面的翻译.
- linux下删除修改时间为某天之前的文件
time_file #新建一个标识文件,修改时间为2014年4月9日0点0分 find . ! -cnewer time_file | xargs rm #删除最后修改时间在上述标识文件之前的所有文件
- Qt_chartdirector图形开发
ChartDirector 是一款商业的图表库,有多种语言的版本,使用它做的图表非常的精 细漂亮,提供免费版本,但会出现logo信息.网上有很多关于它的破解方法. 一.产品优点 高效快捷 采用多线程结 ...