求大侠帮忙将Apache Rewrite改成 Nginx Rewrite配置,万分感谢!!!

txgaozhao 2013-11-13 05:20:20
大家好,由于网站服务器环境要改成Nginx的了,但是Nginx Rewrite配置没接触过,不知道怎么改,求大侠帮忙,万分感谢!!!
这是Apache的Rewrite规则,请问怎么改成Nginx Rewrite呢?

RewriteEngine On
RewriteBase /

RewriteRule ^shop-(.+)-(.+)-(.+)-(.+).html shop\.php\?uid=$1&action=$2&id=$3&m=$4
RewriteRule ^shop-(.+)-(.+)-(.+).html(.+) shop\.php\?uid=$1&action=$2&m=$3$4
RewriteRule ^shop-(.+)-(.+)-(.+).html shop\.php\?uid=$1&action=$2&m=$3

RewriteRule ^search-(.+)-(.+)-(.+).html index\.php\?m=$2&s=$3&key=$1
RewriteRule ^(.+)-(.+)-(.+).html(.+) index\.php\?m=$1&s=$2&id=$3$4
RewriteRule ^(.+)-(.+)-(.+).html index\.php\?m=$1&s=$2&id=$3
RewriteRule ^(.+)-(.+).html(.+) index\.php\?m=$1&s=$2$3
RewriteRule ^(.+)-(.+).html index\.php\?m=$1&s=$2
RewriteRule ^(.+).html(.+) index\.php\?m=$1&$2
RewriteRule ^(\w+).html$ index\.php\?m=$1

RewriteRule ^_(.+)-(.+)-(.+)/(.+) index\.php\?m=$1&s=$2&id=$3$4
RewriteRule ^_(.+)-(.+)-(.+)/ index\.php\?m=$1&s=$2&id=$3
RewriteRule ^_(.+)-(.+)/(.+) index\.php\?m=$1&s=$2$3
RewriteRule ^_(.+)-(.+)/ index\.php\?m=$1&s=$2
RewriteRule ^_(.+)/(.+) index\.php\?m=$1&$2
RewriteRule ^_(.+)/ index\.php\?m=$1


ErrorDocument 404 404\.php
RewriteRule ^templates/(.+)/*.htm$ 404\.php

...全文
429 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
结贴 txgaozhao
txgaozhao 2013-11-14
  • 打赏
  • 举报
回复
引用 1 楼 yetaodiao 的回复:
把apache rewrite 规则转换成nginx rewrite配置 一个自动化的linux命令行工具apache2nginx 能将apache的配置文件转换成相应的nginx的配置文件。 源代码在github上,文档,二进制文件也可以从github上获得。 使用方法:apache2nginx -f /etc/httpd/conf/httpd.conf 将生成 nginx.conf https://github.com/nhnc-nginx/apache2nginx 另外一个选择是在线直接生产。 也可以使用在线转换工具把配置文件httpd.conf自动转换成nginx配置文件nginx.conf,规则转换网址 http://www.anilcetin.com/convert-apache-htaccess-to-nginx/
多谢楼上,帮了大忙~~~
  • 打赏
  • 举报
回复
把apache rewrite 规则转换成nginx rewrite配置 一个自动化的linux命令行工具apache2nginx 能将apache的配置文件转换成相应的nginx的配置文件。 源代码在github上,文档,二进制文件也可以从github上获得。 使用方法:apache2nginx -f /etc/httpd/conf/httpd.conf 将生成 nginx.conf https://github.com/nhnc-nginx/apache2nginx 另外一个选择是在线直接生产。 也可以使用在线转换工具把配置文件httpd.conf自动转换成nginx配置文件nginx.conf,规则转换网址 http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

25,985

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧