利用nginx的rewrite的指令,可以实现url的重新跳转,rewrtie有四种不同的flag,分别是redirect(临时重定向)、permanent(永久重定向)、break和last。其中前两种是跳转型的flag,后两种是代理型,跳转型是指有客户端浏览器重新对新地址进行请求,代理型是在WEB服务器内部实现跳转的

redirect #临时重定向,重写完成后以临时重定向方式直接返回重写后生成的新URL给客户端,有客户端重新发起请求,使用相对路径,http://或https://开头,状态码:302
permanent #永久重定向,以永久重定向的方式直接返回重写后生成的新URL给客户端,由客户端重新发起新的请求,状态码:301
last #重写完成后停止对当前location中后续的其他重写操作,而后对新的URL启动新一轮重写检查,不建议在location中使用
break #重写完成后停止对当前URL在当前location中后续的其他重写操作,而后直接跳转至重写规则匹配块之后的其他配置;结束循环,建议在location中使用

server {
listen ;
server_name n.sinaimg.cn 2008mail.sina.com.cn www.sinaimg.cn ; root /usr/local/sinaria;
rewrite ^/mail/sinamail66/js/\d+/(.*)$ /sinamail66/js/$ last;
rewrite ^/mail/sinamail66/css/\d+/(.*)$ /sinamail66/css/$ last;
rewrite ^/mail/sinamail66/images/\d+/(.*)$ /images/$ last;
rewrite ^/mail/sinamail66/skins/\d+/(.*)$ /skins/$ last;
rewrite ^/mail/sinamail/js/\d+/(.*)$ /mail/$ last;
rewrite ^/rny/webface/conf/\d+/(.*)$ /webface/conf/$ last;
rewrite ^/rny/sinamail66/skins/\d+/(.*)$ /sinamail66/skins/min/$ last;
rewrite ^/rny/sinamail57/images/\d+/(.*)$ /images/$ last;
rewrite ^/js/(.*)$ /js/$ last;
location / {
} }

最新文章

  1. CSS float
  2. Redis集群~StackExchange.redis连接Twemproxy代理服务器
  3. Flask最佳实践
  4. 【转】C++怎么读写windows剪贴板的内容?比如说自动把一个字符串复制.
  5. Hololens开发笔记之Gesture手势识别(单击,双击)
  6. PHP的日期和时间
  7. 比支付宝更好用的读IC卡信息工具
  8. 如何在mysql中退出当前窗口界面而不关闭窗口的方法
  9. 生产者与消费者(三)---BlockingQueue
  10. psql rank row
  11. swift中的&-备
  12. 调用WCF的异步方法
  13. PHP编程效率的20个要点--PHP技术教程分享
  14. 速度之王 — LZ4压缩算法(二)
  15. Docker镜像管理基础与基于容器的镜像制作示例
  16. [20171120]11G关闭直接路径读.txt
  17. iOS开发-- 使用TFHpple解析html
  18. tensoflow模型中提示:ValueError: Variable rnn/basic_rnn_cell/kernel already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? 解决办法
  19. cxGrid之checkbox小结
  20. 团队作业8——测试与发布(Beta阶段)目录

热门文章

  1. ABP入门教程15 - 小结
  2. ubuntu 桌面版, ssh 连接时使用,x转发进行使用 gnome-terminal 时出现:Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached 错误
  3. PHP的stdClass
  4. Day7 - Python基础7 面向对象
  5. 【Oracle】SQL的一些关键字
  6. Rust v1.39发布 - 这个编程语言真不一般!
  7. 使用adb安装apk到手机
  8. cartographer 3D scan matching 理解
  9. 如何查看PDF的坐标
  10. centos安装mongodb 4.x及配置用户名密码(官方推荐的方式)